There are two ways to send authenticated requests to the Medusa server: Using a user's API token, or using a Cookie Session ID.
Use a user's API Token to send authenticated requests.
At the moment, there's no direct way of adding an API Token for a user. The only way it can be done is through directly editing the database.
If you're using a PostgreSQL database, you can run the following commands in your command line to add API token:
psql -d <DB_NAME> -U <DB_USER>
UPDATE public.user SET api_token='<API_TOKEN>' WHERE email='<USER_EMAIL>';
Where:
<DB_NAME> is the name of the database schema you use for the Medusa server.<DB_USER> is the name of the user that has privileges over the database schema.<API_TOKEN> is the API token you want to associate with the user. You can use this tool to generate a random token.<USER_EMAIL> is the email address of the admin user you want to have this API token.The API token can be used for Bearer Authentication. It's passed in the Authorization header as the following:
Authorization: Bearer {api_token}
In this API reference, you'll find in the cURL request samples the use of {api_token}. This is where you must pass the API token.
If you're following along with the JS Client request samples, you must provide the apiKey option when creating the Medusa client:
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3, apiKey: '{api_token}' })
If you're using Medusa React, you can pass the apiKey prop to MedusaProvider:
<MedusaProvider
apiKey='api_token}'
//...
>
bearerIn many endpoints you'll find an expand query parameter that can be passed to the endpoint. You can use the expand query parameter to unpack an entity's relations and return them in the response.
Please note that the relations you pass to expand replace any relations that are expanded by default in the request.
For example, when you retrieve products, you can retrieve their collection by passing to the expand query parameter the value collection:
curl "http://localhost:9000/admin/products?expand=collection" \
-H 'Authorization: Bearer {api_token}'
You can expand more than one relation by separating the relations in the expand query parameter with a comma.
For example, to retrieve both the variants and the collection of products, pass to the expand query parameter the value variants,collection:
curl "http://localhost:9000/admin/products?expand=variants,collection" \
-H 'Authorization: Bearer {api_token}'
Some requests expand relations by default. You can prevent that by passing an empty expand value to retrieve an entity without any extra relations.
For example:
curl "http://localhost:9000/admin/products?expand" \
-H 'Authorization: Bearer {api_token}'
This would retrieve each product with only its properties, without any relations like collection.
In many endpoints you'll find a fields query parameter that can be passed to the endpoint. You can use the fields query parameter to specify which fields in the entity should be returned in the response.
Please note that if you pass a fields query parameter, only the fields you pass in the value along with the id of the entity will be returned in the response.
Also, the fields query parameter does not affect the expanded relations. You'll have to use the expand parameter instead.
For example, when you retrieve a list of products, you can retrieve only the titles of the products by passing title as a value to the fields query parameter:
curl "http://localhost:9000/admin/products?fields=title" \
-H 'Authorization: Bearer {api_token}'
As mentioned above, the expanded relations such as variants will still be returned as they're not affected by the fields parameter.
You can ensure that only the title field is returned by passing an empty value to the expand query parameter. For example:
curl "http://localhost:9000/admin/products?fields=title&expand" \
-H 'Authorization: Bearer {api_token}'
You can pass more than one field by seperating the field names in the fields query parameter with a comma.
For example, to select the title and handle of products:
curl "http://localhost:9000/admin/products?fields=title,handle" \
-H 'Authorization: Bearer {api_token}'
You can pass an empty fields query parameter to return only the ID of an entity. For example:
curl "http://localhost:9000/admin/products?fields" \
-H 'Authorization: Bearer {api_token}'
You can also pair with an empty expand query parameter to ensure that the relations aren't retrieved as well. For example:
curl "http://localhost:9000/admin/products?fields&expand" \
-H 'Authorization: Bearer {api_token}'
This section covers how to pass some common data types as query parameters. This is useful if you're sending requests to the API endpoints and not using our JS Client. For example, when using cURL or Postman.
You can pass a string value in the form of <parameter_name>=<value>.
For example:
curl "http://localhost:9000/admin/products?title=Shirt" \
-H 'Authorization: Bearer {api_token}'
If the string has any characters other than letters and numbers, you must encode them.
For example, if the string has spaces, you can encode the space with + or %20:
curl "http://localhost:9000/admin/products?title=Blue%20Shirt" \
-H 'Authorization: Bearer {api_token}'
You can use tools like this one to learn how a value can be encoded.
You can pass an integer value in the form of <parameter_name>=<value>.
For example:
curl "http://localhost:9000/admin/products?offset=1" \
-H 'Authorization: Bearer {api_token}'
You can pass a boolean value in the form of <parameter_name>=<value>.
For example:
curl "http://localhost:9000/admin/products?is_giftcard=true" \
-H 'Authorization: Bearer {api_token}'
You can pass a date value in the form <parameter_name>=<value>. The date must be in the format YYYY-MM-DD.
For example:
curl -g "http://localhost:9000/admin/products?created_at[lt]=2023-02-17" \
-H 'Authorization: Bearer {api_token}'
You can also pass the time using the format YYYY-MM-DDTHH:MM:SSZ. Please note that the T and Z here are fixed.
For example:
curl -g "http://localhost:9000/admin/products?created_at[lt]=2023-02-17T07:22:30Z" \
-H 'Authorization: Bearer {api_token}'
Each array value must be passed as a separate query parameter in the form <parameter_name>[]=<value>. You can also specify the index of each parameter in the brackets <parameter_name>[0]=<value>.
For example:
curl -g "http://localhost:9000/admin/products?sales_channel_id[]=sc_01GPGVB42PZ7N3YQEP2WDM7PC7&sales_channel_id[]=sc_234PGVB42PZ7N3YQEP2WDM7PC7" \
-H 'Authorization: Bearer {api_token}'
Note that the -g parameter passed to curl disables errors being thrown for using the brackets. Read more here.
Object parameters must be passed as separate query parameters in the form <parameter_name>[<key>]=<value>.
For example:
curl -g "http://localhost:9000/admin/products?created_at[lt]=2023-02-17&created_at[gt]=2022-09-17" \
-H 'Authorization: Bearer {api_token}'
In listing endpoints, such as list customers or list products, you can control the pagination using the query parameters limit and offset.
limit is used to specify the maximum number of items that can be return in the response. offset is used to specify how many items to skip before returning the resulting entities.
You can use the offset query parameter to change between pages. For example, if the limit is 50, at page 1 the offset should be 0; at page 2 the offset should be 50, and so on.
For example, to limit the number of products returned in the List Products endpoint:
curl "http://localhost:9000/admin/products?limit=5" \
-H 'Authorization: Bearer {api_token}'
In the response of listing endpoints, aside from the entities retrieved, there are three pagination-related fields returned: count, limit, and offset.
Similar to the query parameters, limit is the maximum number of items that can be returned in the response, and field is the number of items that were skipped before the entities in the result.
count is the total number of available items of this entity. It can be used to determine how many pages are there.
For example, if the count is 100 and the limit is 50, you can divide the count by the limit to get the number of pages: 100/50 = 2 pages.
The order field available on endpoints supporting pagination allows you to sort the retrieved items by an attribute of that item. For example, you can sort products by their created_at attribute by setting order to created_at:
curl "http://localhost:9000/admin/products?order=created_at" \
-H 'Authorization: Bearer {api_token}'
By default, the sort direction will be ascending. To change it to descending, pass a dash (-) before the attribute name. For example:
curl "http://localhost:9000/admin/products?order=-created_at" \
-H 'Authorization: Bearer {api_token}'
This sorts the products by their created_at attribute in the descending order.
Retrieve a list of applications.
required | Array of objects (OAuth) |
curl --location --request GET 'https://medusa-url.com/admin/apps' \ --header 'Authorization: Bearer {api_token}'
{- "apps": [
- {
- "id": "example_app",
- "display_name": "Example app",
- "application_name": "example",
- "data": { }
}
]
}Generates a token for an application.
| application_name required | string Name of the application for the token to be generated for. |
| state required | string State of the application. |
| code required | string The code for the generated token. |
required | object (OAuth) Represent an OAuth app |
{- "application_name": "string",
- "state": "string",
- "code": "string"
}{- "apps": {
- "id": "example_app",
- "display_name": "Example app",
- "application_name": "example",
- "data": { }
}
}Gets the currently logged in User.
required | object (User) Represents a User who can manage store settings. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.auth.getSession() .then(({ user }) => { console.log(user.id); });
{- "user": {
- "id": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "role": "admin",
- "email": "user@example.com",
- "first_name": "Levi",
- "last_name": "Bogan",
- "api_token": null,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Logs a User in and authorizes them to manage Store settings.
| email required | string The User's email. |
| password required | string The User's password. |
required | object (User) Represents a User who can manage store settings. |
{- "email": "string",
- "password": "string"
}{- "user": {
- "id": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "role": "admin",
- "email": "user@example.com",
- "first_name": "Levi",
- "last_name": "Bogan",
- "api_token": null,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Deletes the current session for the logged in user.
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.auth.deleteSession()
{- "message": "Discount must be set to dynamic",
- "type": "not_allowed"
}Retrieve a list of Batch Jobs.
| limit | integer Default: 10 The number of batch jobs to return. |
| offset | integer Default: 0 The number of batch jobs to skip before results. |
string or Array of strings Filter by the batch ID | |
| type | Array of strings Filter by the batch type |
object Date comparison for when resulting collections was confirmed, i.e. less than, greater than etc. | |
object Date comparison for when resulting collections was pre processed, i.e. less than, greater than etc. | |
object Date comparison for when resulting collections was completed, i.e. less than, greater than etc. | |
object Date comparison for when resulting collections was failed, i.e. less than, greater than etc. | |
object Date comparison for when resulting collections was canceled, i.e. less than, greater than etc. | |
| order | string Field used to order retrieved batch jobs |
| expand | string (Comma separated) Which fields should be expanded in each order of the result. |
| fields | string (Comma separated) Which fields should be included in each order of the result. |
object Date comparison for when resulting collections was created, i.e. less than, greater than etc. | |
object Date comparison for when resulting collections was updated, i.e. less than, greater than etc. |
required | Array of objects (Batch Job) |
| count required | integer The total number of items available |
| offset required | integer The number of items skipped before these items |
| limit required | integer The number of items per page |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.batchJobs.list() .then(({ batch_jobs, limit, offset, count }) => { console.log(batch_jobs.length); });
{- "batch_jobs": [
- {
- "id": "batch_01G8T782965PYFG0751G0Z38B4",
- "type": "product-import",
- "status": "created",
- "created_by": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "created_by_user": {
- "id": null,
- "role": null,
- "email": null,
- "first_name": null,
- "last_name": null,
- "api_token": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "context": {
- "shape": {
- "prices": [
- {
- "region": null,
- "currency_code": "eur"
}
], - "dynamicImageColumnCount": 4,
- "dynamicOptionColumnCount": 2
}, - "list_config": {
- "skip": 0,
- "take": 50,
- "order": {
- "created_at": "DESC"
}, - "relations": [
- "variants",
- "variant.prices",
- "images"
]
}
}, - "dry_run": false,
- "result": {
- "errors": [
- {
- "err": [ ],
- "code": "unknown",
- "message": "Method not implemented."
}
], - "stat_descriptors": [
- {
- "key": "product-export-count",
- "name": "Product count to export",
- "message": "There will be 8 products exported by this action"
}
]
}, - "pre_processed_at": "2019-08-24T14:15:22Z",
- "processing_at": "2019-08-24T14:15:22Z",
- "confirmed_at": "2019-08-24T14:15:22Z",
- "completed_at": "2019-08-24T14:15:22Z",
- "canceled_at": "2019-08-24T14:15:22Z",
- "failed_at": "2019-08-24T14:15:22Z",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}Creates a Batch Job.
| type required | string Example: "product-export" The type of batch job to start. |
| context required | object Example: {"shape":{"prices":[{"region":null,"currency_code":"eur"}],"dynamicImageColumnCount":4,"dynamicOptionColumnCount":2},"list_config":{"skip":0,"take":50,"order":{"created_at":"DESC"},"relations":["variants","variant.prices","images"]}} Additional infomration regarding the batch to be used for processing. |
| dry_run | boolean Default: false Set a batch job in dry_run mode to get some information on what will be done without applying any modifications. |
{- "type": "product-export",
- "context": {
- "shape": {
- "prices": [
- {
- "region": null,
- "currency_code": "eur"
}
], - "dynamicImageColumnCount": 4,
- "dynamicOptionColumnCount": 2
}, - "list_config": {
- "skip": 0,
- "take": 50,
- "order": {
- "created_at": "DESC"
}, - "relations": [
- "variants",
- "variant.prices",
- "images"
]
}
}, - "dry_run": false
}{- "batch_job": {
- "id": "batch_01G8T782965PYFG0751G0Z38B4",
- "type": "product-import",
- "status": "created",
- "created_by": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "created_by_user": {
- "id": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "role": "admin",
- "email": "user@example.com",
- "first_name": "Levi",
- "last_name": "Bogan",
- "api_token": null,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "context": {
- "shape": {
- "prices": [
- {
- "region": null,
- "currency_code": "eur"
}
], - "dynamicImageColumnCount": 4,
- "dynamicOptionColumnCount": 2
}, - "list_config": {
- "skip": 0,
- "take": 50,
- "order": {
- "created_at": "DESC"
}, - "relations": [
- "variants",
- "variant.prices",
- "images"
]
}
}, - "dry_run": false,
- "result": {
- "errors": [
- {
- "err": [ ],
- "code": "unknown",
- "message": "Method not implemented."
}
], - "stat_descriptors": [
- {
- "key": "product-export-count",
- "name": "Product count to export",
- "message": "There will be 8 products exported by this action"
}
]
}, - "pre_processed_at": "2019-08-24T14:15:22Z",
- "processing_at": "2019-08-24T14:15:22Z",
- "confirmed_at": "2019-08-24T14:15:22Z",
- "completed_at": "2019-08-24T14:15:22Z",
- "canceled_at": "2019-08-24T14:15:22Z",
- "failed_at": "2019-08-24T14:15:22Z",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}Retrieves a Batch Job.
| id required | string The ID of the Batch Job |
required | object (Batch Job) A Batch Job. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.batchJobs.retrieve(batch_job_id) .then(({ batch_job }) => { console.log(batch_job.id); });
{- "batch_job": {
- "id": "batch_01G8T782965PYFG0751G0Z38B4",
- "type": "product-import",
- "status": "created",
- "created_by": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "created_by_user": {
- "id": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "role": "admin",
- "email": "user@example.com",
- "first_name": "Levi",
- "last_name": "Bogan",
- "api_token": null,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "context": {
- "shape": {
- "prices": [
- {
- "region": null,
- "currency_code": "eur"
}
], - "dynamicImageColumnCount": 4,
- "dynamicOptionColumnCount": 2
}, - "list_config": {
- "skip": 0,
- "take": 50,
- "order": {
- "created_at": "DESC"
}, - "relations": [
- "variants",
- "variant.prices",
- "images"
]
}
}, - "dry_run": false,
- "result": {
- "errors": [
- {
- "err": [ ],
- "code": "unknown",
- "message": "Method not implemented."
}
], - "stat_descriptors": [
- {
- "key": "product-export-count",
- "name": "Product count to export",
- "message": "There will be 8 products exported by this action"
}
]
}, - "pre_processed_at": "2019-08-24T14:15:22Z",
- "processing_at": "2019-08-24T14:15:22Z",
- "confirmed_at": "2019-08-24T14:15:22Z",
- "completed_at": "2019-08-24T14:15:22Z",
- "canceled_at": "2019-08-24T14:15:22Z",
- "failed_at": "2019-08-24T14:15:22Z",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}Marks a batch job as canceled
| id required | string The ID of the batch job. |
required | object (Batch Job) A Batch Job. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.batchJobs.cancel(batch_job_id) .then(({ batch_job }) => { console.log(batch_job.id); });
{- "batch_job": {
- "id": "batch_01G8T782965PYFG0751G0Z38B4",
- "type": "product-import",
- "status": "created",
- "created_by": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "created_by_user": {
- "id": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "role": "admin",
- "email": "user@example.com",
- "first_name": "Levi",
- "last_name": "Bogan",
- "api_token": null,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "context": {
- "shape": {
- "prices": [
- {
- "region": null,
- "currency_code": "eur"
}
], - "dynamicImageColumnCount": 4,
- "dynamicOptionColumnCount": 2
}, - "list_config": {
- "skip": 0,
- "take": 50,
- "order": {
- "created_at": "DESC"
}, - "relations": [
- "variants",
- "variant.prices",
- "images"
]
}
}, - "dry_run": false,
- "result": {
- "errors": [
- {
- "err": [ ],
- "code": "unknown",
- "message": "Method not implemented."
}
], - "stat_descriptors": [
- {
- "key": "product-export-count",
- "name": "Product count to export",
- "message": "There will be 8 products exported by this action"
}
]
}, - "pre_processed_at": "2019-08-24T14:15:22Z",
- "processing_at": "2019-08-24T14:15:22Z",
- "confirmed_at": "2019-08-24T14:15:22Z",
- "completed_at": "2019-08-24T14:15:22Z",
- "canceled_at": "2019-08-24T14:15:22Z",
- "failed_at": "2019-08-24T14:15:22Z",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}Confirms that a previously requested batch job should be executed.
| id required | string The ID of the batch job. |
required | object (Batch Job) A Batch Job. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.batchJobs.confirm(batch_job_id) .then(({ batch_job }) => { console.log(batch_job.id); });
{- "batch_job": {
- "id": "batch_01G8T782965PYFG0751G0Z38B4",
- "type": "product-import",
- "status": "created",
- "created_by": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "created_by_user": {
- "id": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "role": "admin",
- "email": "user@example.com",
- "first_name": "Levi",
- "last_name": "Bogan",
- "api_token": null,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "context": {
- "shape": {
- "prices": [
- {
- "region": null,
- "currency_code": "eur"
}
], - "dynamicImageColumnCount": 4,
- "dynamicOptionColumnCount": 2
}, - "list_config": {
- "skip": 0,
- "take": 50,
- "order": {
- "created_at": "DESC"
}, - "relations": [
- "variants",
- "variant.prices",
- "images"
]
}
}, - "dry_run": false,
- "result": {
- "errors": [
- {
- "err": [ ],
- "code": "unknown",
- "message": "Method not implemented."
}
], - "stat_descriptors": [
- {
- "key": "product-export-count",
- "name": "Product count to export",
- "message": "There will be 8 products exported by this action"
}
]
}, - "pre_processed_at": "2019-08-24T14:15:22Z",
- "processing_at": "2019-08-24T14:15:22Z",
- "confirmed_at": "2019-08-24T14:15:22Z",
- "completed_at": "2019-08-24T14:15:22Z",
- "canceled_at": "2019-08-24T14:15:22Z",
- "failed_at": "2019-08-24T14:15:22Z",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}Retrieve a list of Product Collection.
| limit | integer Default: 10 The number of collections to return. |
| offset | integer Default: 0 The number of collections to skip before the results. |
| title | string The title of collections to return. |
| handle | string The handle of collections to return. |
| q | string a search term to search titles and handles. |
| discount_condition_id | string The discount condition id on which to filter the product collections. |
object Date comparison for when resulting collections were created. | |
object Date comparison for when resulting collections were updated. | |
object Date comparison for when resulting collections were deleted. |
required | Array of objects (Product Collection) |
| count required | integer The total number of items available |
| offset required | integer The number of items skipped before these items |
| limit required | integer The number of items per page |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.collections.list() .then(({ collections, limit, offset, count }) => { console.log(collections.length); });
{- "collections": [
- {
- "id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "title": "Summer Collection",
- "handle": "summer-collection",
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}Creates a Product Collection.
| title required | string The title to identify the Collection by. |
| handle | string An optional handle to be used in slugs, if none is provided we will kebab-case the title. |
| metadata | object An optional set of key-value pairs to hold additional information. |
required | object (Product Collection) Product Collections represents a group of Products that are related. |
{- "title": "string",
- "handle": "string",
- "metadata": { }
}{- "collection": {
- "id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "title": "Summer Collection",
- "handle": "summer-collection",
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Retrieves a Product Collection.
| id required | string The ID of the Product Collection |
required | object (Product Collection) Product Collections represents a group of Products that are related. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.collections.retrieve(collection_id) .then(({ collection }) => { console.log(collection.id); });
{- "collection": {
- "id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "title": "Summer Collection",
- "handle": "summer-collection",
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Updates a Product Collection.
| id required | string The ID of the Collection. |
| title | string The title to identify the Collection by. |
| handle | string An optional handle to be used in slugs, if none is provided we will kebab-case the title. |
| metadata | object An optional set of key-value pairs to hold additional information. |
required | object (Product Collection) Product Collections represents a group of Products that are related. |
{- "title": "string",
- "handle": "string",
- "metadata": { }
}{- "collection": {
- "id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "title": "Summer Collection",
- "handle": "summer-collection",
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Deletes a Product Collection.
| id required | string The ID of the Collection. |
| id required | string The ID of the deleted Collection |
| object required | string Default: "product-collection" The type of the object that was deleted. |
| deleted required | boolean Default: true Whether the collection was deleted successfully or not. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.collections.delete(collection_id) .then(({ id, object, deleted }) => { console.log(id); });
{- "id": "string",
- "object": "product-collection",
- "deleted": true
}Updates products associated with a Product Collection
| id required | string The ID of the Collection. |
| product_ids required | Array of strings An array of Product IDs to add to the Product Collection. |
required | object (Product Collection) Product Collections represents a group of Products that are related. |
{- "product_ids": [
- "string"
]
}{- "collection": {
- "id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "title": "Summer Collection",
- "handle": "summer-collection",
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Removes products associated with a Product Collection
| id required | string The ID of the Collection. |
| product_ids required | Array of strings An array of Product IDs to remove from the Product Collection. |
| id required | string The ID of the collection |
| object required | string Default: "product-collection" The type of object the removal was executed on |
| removed_products required | Array of strings The IDs of the products removed from the collection |
{- "product_ids": [
- "string"
]
}{- "id": "string",
- "object": "product-collection",
- "removed_products": [
- "string"
]
}Retrieves a list of Currency
| code | string Code of the currency to search for. |
| includes_tax | boolean Search for tax inclusive currencies. |
| order | string order to retrieve products in. |
| offset | number Default: "0" How many products to skip in the result. |
| limit | number Default: "20" Limit the number of products returned. |
required | Array of objects (Currency) |
| count required | integer The total number of items available |
| offset required | integer The number of items skipped before these items |
| limit required | integer The number of items per page |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.currencies.list() .then(({ currencies, count, offset, limit }) => { console.log(currencies.length); });
{- "currencies": [
- {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}Update a Currency
| code required | string The code of the Currency. |
| includes_tax | boolean [EXPERIMENTAL] Tax included in prices of currency. |
required | object (Currency) Currency |
{- "includes_tax": true
}{- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}
}Retrieve a list of customer groups.
| q | string Query used for searching customer group names. |
| offset | integer Default: 0 How many groups to skip in the result. |
| order | string the field used to order the customer groups. |
| discount_condition_id | string The discount condition id on which to filter the customer groups. |
string or Array of strings or object Filter by the customer group ID | |
| name | Array of strings Filter by the customer group name |
object Date comparison for when resulting customer groups were created. | |
object Date comparison for when resulting customer groups were updated. | |
| limit | integer Default: 10 Limit the number of customer groups returned. |
| expand | string (Comma separated) Which fields should be expanded in each customer groups of the result. |
required | Array of objects (Customer Group) |
| count required | integer The total number of items available |
| offset required | integer The number of items skipped before these items |
| limit required | integer The number of items per page |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.customerGroups.list() .then(({ customer_groups, limit, offset, count }) => { console.log(customer_groups.length); });
{- "customer_groups": [
- {
- "id": "cgrp_01G8ZH853Y6TFXWPG5EYE81X63",
- "name": "VIP",
- "customers": [
- { }
], - "price_lists": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}Creates a CustomerGroup.
| name required | string Name of the customer group |
| metadata | object Metadata for the customer. |
required | object (Customer Group) Represents a customer group |
{- "name": "string",
- "metadata": { }
}{- "customer_group": {
- "id": "cgrp_01G8ZH853Y6TFXWPG5EYE81X63",
- "name": "VIP",
- "customers": [
- { }
], - "price_lists": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Retrieves a Customer Group.
| id required | string The ID of the Customer Group. |
| expand | string (Comma separated) Which fields should be expanded in the customer group. |
| fields | string (Comma separated) Which fields should be included in the customer group. |
required | object (Customer Group) Represents a customer group |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.customerGroups.retrieve(customer_group_id) .then(({ customer_group }) => { console.log(customer_group.id); });
{- "customer_group": {
- "id": "cgrp_01G8ZH853Y6TFXWPG5EYE81X63",
- "name": "VIP",
- "customers": [
- { }
], - "price_lists": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Update a CustomerGroup.
| id required | string The ID of the customer group. |
| name | string Name of the customer group |
| metadata | object Metadata for the customer. |
required | object (Customer Group) Represents a customer group |
{- "name": "string",
- "metadata": { }
}{- "customer_group": {
- "id": "cgrp_01G8ZH853Y6TFXWPG5EYE81X63",
- "name": "VIP",
- "customers": [
- { }
], - "price_lists": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Deletes a CustomerGroup.
| id required | string The ID of the Customer Group |
| id required | string The ID of the deleted customer group. |
| object required | string Default: "customer_group" The type of the object that was deleted. |
| deleted required | boolean Default: true Whether the customer group was deleted successfully or not. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.customerGroups.delete(customer_group_id) .then(({ id, object, deleted }) => { console.log(id); });
{- "id": "string",
- "object": "customer_group",
- "deleted": true
}Retrieves a list of customers in a customer group
| id required | string The ID of the customer group. |
| limit | integer Default: 50 The number of items to return. |
| offset | integer Default: 0 The items to skip before result. |
| expand | string (Comma separated) Which fields should be expanded in each customer. |
| q | string a search term to search email, first_name, and last_name. |
required | Array of objects (Customer) |
| count required | integer The total number of items available |
| offset required | integer The number of items skipped before these items |
| limit required | integer The number of items per page |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.customerGroups.listCustomers(customer_group_id) .then(({ customers }) => { console.log(customers.length); });
{- "customers": [
- {
- "id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "email": "user@example.com",
- "first_name": "Arno",
- "last_name": "Willms",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": null,
- "customer_id": null,
- "customer": { },
- "company": null,
- "first_name": null,
- "last_name": null,
- "address_1": null,
- "address_2": null,
- "city": null,
- "country_code": null,
- "country": null,
- "province": null,
- "postal_code": null,
- "phone": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "shipping_addresses": [
- null
], - "phone": 16128234334802,
- "has_account": false,
- "orders": [
- { }
], - "groups": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}Adds a list of customers, represented by id's, to a customer group.
| id required | string The ID of the customer group. |
required | Array of objects The ids of the customers to add |
required | object (Customer Group) Represents a customer group |
{- "customer_ids": [
- {
- "id": "string"
}
]
}{- "customer_group": {
- "id": "cgrp_01G8ZH853Y6TFXWPG5EYE81X63",
- "name": "VIP",
- "customers": [
- { }
], - "price_lists": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Removes a list of customers, represented by id's, from a customer group.
| id required | string The ID of the customer group. |
required | Array of objects The ids of the customers to remove |
required | object (Customer Group) Represents a customer group |
{- "customer_ids": [
- {
- "id": "string"
}
]
}{- "customer_group": {
- "id": "cgrp_01G8ZH853Y6TFXWPG5EYE81X63",
- "name": "VIP",
- "customers": [
- { }
], - "price_lists": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Retrieves a list of Customers.
| limit | integer Default: 50 The number of items to return. |
| offset | integer Default: 0 The items to skip before result. |
| expand | string (Comma separated) Which fields should be expanded in each customer. |
| q | string a search term to search email, first_name, and last_name. |
required | Array of objects (Customer) |
| count required | integer The total number of items available |
| offset required | integer The number of items skipped before these items |
| limit required | integer The number of items per page |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.customers.list() .then(({ customers, limit, offset, count }) => { console.log(customers.length); });
{- "customers": [
- {
- "id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "email": "user@example.com",
- "first_name": "Arno",
- "last_name": "Willms",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": null,
- "customer_id": null,
- "customer": { },
- "company": null,
- "first_name": null,
- "last_name": null,
- "address_1": null,
- "address_2": null,
- "city": null,
- "country_code": null,
- "country": null,
- "province": null,
- "postal_code": null,
- "phone": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "shipping_addresses": [
- null
], - "phone": 16128234334802,
- "has_account": false,
- "orders": [
- { }
], - "groups": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}Creates a Customer.
| email required | string <email> The customer's email. |
| first_name required | string The customer's first name. |
| last_name required | string The customer's last name. |
| password required | string <password> The customer's password. |
| phone | string The customer's phone number. |
| metadata | object An optional set of key-value pairs to hold additional information. |
{- "email": "user@example.com",
- "first_name": "string",
- "last_name": "string",
- "password": "pa$$word",
- "phone": "string",
- "metadata": { }
}{- "customer": {
- "id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "email": "user@example.com",
- "first_name": "Arno",
- "last_name": "Willms",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_addresses": [
- {
- "id": null,
- "customer_id": null,
- "customer": { },
- "company": null,
- "first_name": null,
- "last_name": null,
- "address_1": null,
- "address_2": null,
- "city": null,
- "country_code": null,
- "country": null,
- "province": null,
- "postal_code": null,
- "phone": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "phone": 16128234334802,
- "has_account": false,
- "orders": [
- { }
], - "groups": [
- {
- "id": null,
- "name": null,
- "customers": [ ],
- "price_lists": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Retrieves a Customer.
| id required | string The ID of the Customer. |
| expand | string (Comma separated) Which fields should be expanded in the customer. |
| fields | string (Comma separated) Which fields should be included in the customer. |
required | object (Customer) Represents a customer |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.customers.retrieve(customer_id) .then(({ customer }) => { console.log(customer.id); });
{- "customer": {
- "id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "email": "user@example.com",
- "first_name": "Arno",
- "last_name": "Willms",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_addresses": [
- {
- "id": null,
- "customer_id": null,
- "customer": { },
- "company": null,
- "first_name": null,
- "last_name": null,
- "address_1": null,
- "address_2": null,
- "city": null,
- "country_code": null,
- "country": null,
- "province": null,
- "postal_code": null,
- "phone": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "phone": 16128234334802,
- "has_account": false,
- "orders": [
- { }
], - "groups": [
- {
- "id": null,
- "name": null,
- "customers": [ ],
- "price_lists": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Updates a Customer.
| id required | string The ID of the Customer. |
| expand | string (Comma separated) Which fields should be expanded in each customer. |
| fields | string (Comma separated) Which fields should be retrieved in each customer. |
string <email> The Customer's email. | |
| first_name | string The Customer's first name. |
| last_name | string The Customer's last name. |
| phone | string The Customer's phone number. |
| password | string <password> The Customer's password. |
Array of objects A list of customer groups to which the customer belongs. | |
| metadata | object An optional set of key-value pairs to hold additional information. |
required | object (Customer) Represents a customer |
{- "email": "user@example.com",
- "first_name": "string",
- "last_name": "string",
- "phone": "string",
- "password": "pa$$word",
- "groups": [
- {
- "id": "string"
}
], - "metadata": { }
}{- "customer": {
- "id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "email": "user@example.com",
- "first_name": "Arno",
- "last_name": "Willms",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_addresses": [
- {
- "id": null,
- "customer_id": null,
- "customer": { },
- "company": null,
- "first_name": null,
- "last_name": null,
- "address_1": null,
- "address_2": null,
- "city": null,
- "country_code": null,
- "country": null,
- "province": null,
- "postal_code": null,
- "phone": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "phone": 16128234334802,
- "has_account": false,
- "orders": [
- { }
], - "groups": [
- {
- "id": null,
- "name": null,
- "customers": [ ],
- "price_lists": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Retrieves a list of Discounts
| q | string Search query applied on the code field. |
object Discount Rules filters to apply on the search | |
| is_dynamic | boolean Return only dynamic discounts. |
| is_disabled | boolean Return only disabled discounts. |
| limit | number Default: "20" The number of items in the response |
| offset | number Default: "0" The offset of items in response |
| expand | string Comma separated list of relations to include in the results. |
required | Array of objects (Discount) |
| count required | integer The total number of items available |
| offset required | integer The number of items skipped before these items |
| limit required | integer The number of items per page |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.discounts.list() .then(({ discounts, limit, offset, count }) => { console.log(discounts.id); });
{- "discounts": [
- {
- "id": "disc_01F0YESMW10MGHWJKZSDDMN0VN",
- "code": "10DISC",
- "is_dynamic": false,
- "rule_id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "rule": {
- "id": null,
- "type": null,
- "description": null,
- "value": null,
- "allocation": null,
- "conditions": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "is_disabled": false,
- "parent_discount_id": "disc_01G8ZH853YPY9B94857DY91YGW",
- "parent_discount": { },
- "starts_at": "2019-08-24T14:15:22Z",
- "ends_at": "2019-08-24T14:15:22Z",
- "valid_duration": "P3Y6M4DT12H30M5S",
- "regions": [
- null
], - "usage_limit": 100,
- "usage_count": 50,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}Creates a Discount with a given set of rules that define how the Discount behaves.
| expand | string (Comma separated) Which fields should be expanded in the results. |
| fields | string (Comma separated) Which fields should be retrieved in the results. |
| code required | string A unique code that will be used to redeem the Discount |
required | object The Discount Rule that defines how Discounts are calculated |
| regions required | Array of strings A list of Region ids representing the Regions in which the Discount can be used. |
| is_dynamic | boolean Default: false Whether the Discount should have multiple instances of itself, each with a different code. This can be useful for automatically generated codes that all have to follow a common set of rules. |
| is_disabled | boolean Default: false Whether the Discount code is disabled on creation. You will have to enable it later to make it available to Customers. |
| starts_at | string <date-time> The time at which the Discount should be available. |
| ends_at | string <date-time> The time at which the Discount should no longer be available. |
| valid_duration | string Example: "P3Y6M4DT12H30M5S" Duration the discount runs between |
| usage_limit | number Maximum times the discount can be used |
| metadata | object An optional set of key-value pairs to hold additional information. |
required | object (Discount) Represents a discount that can be applied to a cart for promotional purposes. |
{- "code": "string",
- "is_dynamic": false,
- "rule": {
- "description": "string",
- "type": "fixed",
- "value": 0,
- "allocation": "total",
- "conditions": [
- {
- "operator": null,
- "products": [ ],
- "product_types": [ ],
- "product_collections": [ ],
- "product_tags": [ ],
- "customer_groups": [ ]
}
]
}, - "is_disabled": false,
- "starts_at": "2019-08-24T14:15:22Z",
- "ends_at": "2019-08-24T14:15:22Z",
- "valid_duration": "P3Y6M4DT12H30M5S",
- "regions": [
- "string"
], - "usage_limit": 0,
- "metadata": { }
}{- "discount": {
- "id": "disc_01F0YESMW10MGHWJKZSDDMN0VN",
- "code": "10DISC",
- "is_dynamic": false,
- "rule_id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "rule": {
- "id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "type": "percentage",
- "description": "10 Percent",
- "value": 10,
- "allocation": "total",
- "conditions": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "is_disabled": false,
- "parent_discount_id": "disc_01G8ZH853YPY9B94857DY91YGW",
- "parent_discount": { },
- "starts_at": "2019-08-24T14:15:22Z",
- "ends_at": "2019-08-24T14:15:22Z",
- "valid_duration": "P3Y6M4DT12H30M5S",
- "regions": [
- {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "usage_limit": 100,
- "usage_count": 50,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Retrieves a Discount by its discount code
| code required | string The code of the Discount |
| expand | string Comma separated list of relations to include in the results. |
| fields | string Comma separated list of fields to include in the results. |
required | object (Discount) Represents a discount that can be applied to a cart for promotional purposes. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.discounts.retrieveByCode(code) .then(({ discount }) => { console.log(discount.id); });
{- "discount": {
- "id": "disc_01F0YESMW10MGHWJKZSDDMN0VN",
- "code": "10DISC",
- "is_dynamic": false,
- "rule_id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "rule": {
- "id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "type": "percentage",
- "description": "10 Percent",
- "value": 10,
- "allocation": "total",
- "conditions": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "is_disabled": false,
- "parent_discount_id": "disc_01G8ZH853YPY9B94857DY91YGW",
- "parent_discount": { },
- "starts_at": "2019-08-24T14:15:22Z",
- "ends_at": "2019-08-24T14:15:22Z",
- "valid_duration": "P3Y6M4DT12H30M5S",
- "regions": [
- {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "usage_limit": 100,
- "usage_count": 50,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Creates a DiscountCondition. Only one of products, product_types, product_collections, product_tags, and customer_groups should be provided.
| discount_id required | string The ID of the Product. |
| expand | string (Comma separated) Which fields should be expanded in each product of the result. |
| fields | string (Comma separated) Which fields should be included in each product of the result. |
| operator required | string Enum: "in" "not_in" Operator of the condition |
| products | Array of strings list of product IDs if the condition is applied on products. |
| product_types | Array of strings list of product type IDs if the condition is applied on product types. |
| product_collections | Array of strings list of product collection IDs if the condition is applied on product collections. |
| product_tags | Array of strings list of product tag IDs if the condition is applied on product tags. |
| customer_groups | Array of strings list of customer group IDs if the condition is applied on customer groups. |
required | object (Discount) Represents a discount that can be applied to a cart for promotional purposes. |
{- "operator": "in",
- "products": [
- "string"
], - "product_types": [
- "string"
], - "product_collections": [
- "string"
], - "product_tags": [
- "string"
], - "customer_groups": [
- "string"
]
}{- "discount": {
- "id": "disc_01F0YESMW10MGHWJKZSDDMN0VN",
- "code": "10DISC",
- "is_dynamic": false,
- "rule_id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "rule": {
- "id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "type": "percentage",
- "description": "10 Percent",
- "value": 10,
- "allocation": "total",
- "conditions": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "is_disabled": false,
- "parent_discount_id": "disc_01G8ZH853YPY9B94857DY91YGW",
- "parent_discount": { },
- "starts_at": "2019-08-24T14:15:22Z",
- "ends_at": "2019-08-24T14:15:22Z",
- "valid_duration": "P3Y6M4DT12H30M5S",
- "regions": [
- {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "usage_limit": 100,
- "usage_count": 50,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Gets a DiscountCondition
| discount_id required | string The ID of the Discount. |
| condition_id required | string The ID of the DiscountCondition. |
| expand | string Comma separated list of relations to include in the results. |
| fields | string Comma separated list of fields to include in the results. |
required | object (Discount Condition) Holds rule conditions for when a discount is applicable |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.discounts.getCondition(discount_id, condition_id) .then(({ discount_condition }) => { console.log(discount_condition.id); });
{- "discount_condition": {
- "id": "discon_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "type": "products",
- "operator": "in",
- "discount_rule_id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "discount_rule": {
- "id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "type": "percentage",
- "description": "10 Percent",
- "value": 10,
- "allocation": "total",
- "conditions": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "products": [
- {
- "id": null,
- "title": null,
- "subtitle": null,
- "description": null,
- "handle": null,
- "is_giftcard": null,
- "status": null,
- "images": [ ],
- "thumbnail": null,
- "options": [ ],
- "variants": [ ],
- "categories": [ ],
- "profile_id": null,
- "profile": null,
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": null,
- "collection": null,
- "type_id": null,
- "type": null,
- "tags": [ ],
- "discountable": null,
- "external_id": null,
- "sales_channels": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "product_types": [
- {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "product_tags": [
- {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "product_collections": [
- {
- "id": null,
- "title": null,
- "handle": null,
- "products": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "customer_groups": [
- {
- "id": null,
- "name": null,
- "customers": [ ],
- "price_lists": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Updates a DiscountCondition. Only one of products, product_types, product_collections, product_tags, and customer_groups should be provided.
| discount_id required | string The ID of the Product. |
| condition_id required | string The ID of the DiscountCondition. |
| expand | string (Comma separated) Which fields should be expanded in each item of the result. |
| fields | string (Comma separated) Which fields should be included in each item of the result. |
| products | Array of strings list of product IDs if the condition is applied on products. |
| product_types | Array of strings list of product type IDs if the condition is applied on product types. |
| product_collections | Array of strings list of product collection IDs if the condition is applied on product collections. |
| product_tags | Array of strings list of product tag IDs if the condition is applied on product tags. |
| customer_groups | Array of strings list of customer group IDs if the condition is applied on customer groups. |
required | object (Discount) Represents a discount that can be applied to a cart for promotional purposes. |
{- "products": [
- "string"
], - "product_types": [
- "string"
], - "product_collections": [
- "string"
], - "product_tags": [
- "string"
], - "customer_groups": [
- "string"
]
}{- "discount": {
- "id": "disc_01F0YESMW10MGHWJKZSDDMN0VN",
- "code": "10DISC",
- "is_dynamic": false,
- "rule_id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "rule": {
- "id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "type": "percentage",
- "description": "10 Percent",
- "value": 10,
- "allocation": "total",
- "conditions": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "is_disabled": false,
- "parent_discount_id": "disc_01G8ZH853YPY9B94857DY91YGW",
- "parent_discount": { },
- "starts_at": "2019-08-24T14:15:22Z",
- "ends_at": "2019-08-24T14:15:22Z",
- "valid_duration": "P3Y6M4DT12H30M5S",
- "regions": [
- {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "usage_limit": 100,
- "usage_count": 50,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Deletes a DiscountCondition
| discount_id required | string The ID of the Discount |
| condition_id required | string The ID of the DiscountCondition |
| expand | string Comma separated list of relations to include in the results. |
| fields | string Comma separated list of fields to include in the results. |
| id required | string The ID of the deleted DiscountCondition |
| object required | string Default: "discount-condition" The type of the object that was deleted. |
| deleted required | boolean Default: true Whether the discount condition was deleted successfully or not. |
required | object (Discount) Represents a discount that can be applied to a cart for promotional purposes. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.discounts.deleteCondition(discount_id, condition_id) .then(({ id, object, deleted }) => { console.log(id); });
{- "id": "string",
- "object": "discount-condition",
- "deleted": true,
- "discount": {
- "id": "disc_01F0YESMW10MGHWJKZSDDMN0VN",
- "code": "10DISC",
- "is_dynamic": false,
- "rule_id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "rule": {
- "id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "type": "percentage",
- "description": "10 Percent",
- "value": 10,
- "allocation": "total",
- "conditions": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "is_disabled": false,
- "parent_discount_id": "disc_01G8ZH853YPY9B94857DY91YGW",
- "parent_discount": { },
- "starts_at": "2019-08-24T14:15:22Z",
- "ends_at": "2019-08-24T14:15:22Z",
- "valid_duration": "P3Y6M4DT12H30M5S",
- "regions": [
- {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "usage_limit": 100,
- "usage_count": 50,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Add a batch of resources to a discount condition.
| discount_id required | string The ID of the Product. |
| condition_id required | string The ID of the condition on which to add the item. |
| expand | string (Comma separated) Which relations should be expanded in each discount of the result. |
| fields | string (Comma separated) Which fields should be included in each discount of the result. |
required | Array of objects The resources to be added to the discount condition |
required | object (Discount) Represents a discount that can be applied to a cart for promotional purposes. |
{- "resources": [
- {
- "id": "string"
}
]
}{- "discount": {
- "id": "disc_01F0YESMW10MGHWJKZSDDMN0VN",
- "code": "10DISC",
- "is_dynamic": false,
- "rule_id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "rule": {
- "id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "type": "percentage",
- "description": "10 Percent",
- "value": 10,
- "allocation": "total",
- "conditions": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "is_disabled": false,
- "parent_discount_id": "disc_01G8ZH853YPY9B94857DY91YGW",
- "parent_discount": { },
- "starts_at": "2019-08-24T14:15:22Z",
- "ends_at": "2019-08-24T14:15:22Z",
- "valid_duration": "P3Y6M4DT12H30M5S",
- "regions": [
- {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "usage_limit": 100,
- "usage_count": 50,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Delete a batch of resources from a discount condition.
| discount_id required | string The ID of the Product. |
| condition_id required | string The ID of the condition on which to add the item. |
| expand | string (Comma separated) Which relations should be expanded in each discount of the result. |
| fields | string (Comma separated) Which fields should be included in each discount of the result. |
required | Array of objects The resources to be deleted from the discount condition |
required | object (Discount) Represents a discount that can be applied to a cart for promotional purposes. |
{- "resources": [
- {
- "id": "string"
}
]
}{- "discount": {
- "id": "disc_01F0YESMW10MGHWJKZSDDMN0VN",
- "code": "10DISC",
- "is_dynamic": false,
- "rule_id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "rule": {
- "id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "type": "percentage",
- "description": "10 Percent",
- "value": 10,
- "allocation": "total",
- "conditions": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "is_disabled": false,
- "parent_discount_id": "disc_01G8ZH853YPY9B94857DY91YGW",
- "parent_discount": { },
- "starts_at": "2019-08-24T14:15:22Z",
- "ends_at": "2019-08-24T14:15:22Z",
- "valid_duration": "P3Y6M4DT12H30M5S",
- "regions": [
- {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "usage_limit": 100,
- "usage_count": 50,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Retrieves a Discount
| id required | string The ID of the Discount |
| expand | string Comma separated list of relations to include in the results. |
| fields | string Comma separated list of fields to include in the results. |
required | object (Discount) Represents a discount that can be applied to a cart for promotional purposes. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.discounts.retrieve(discount_id) .then(({ discount }) => { console.log(discount.id); });
{- "discount": {
- "id": "disc_01F0YESMW10MGHWJKZSDDMN0VN",
- "code": "10DISC",
- "is_dynamic": false,
- "rule_id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "rule": {
- "id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "type": "percentage",
- "description": "10 Percent",
- "value": 10,
- "allocation": "total",
- "conditions": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "is_disabled": false,
- "parent_discount_id": "disc_01G8ZH853YPY9B94857DY91YGW",
- "parent_discount": { },
- "starts_at": "2019-08-24T14:15:22Z",
- "ends_at": "2019-08-24T14:15:22Z",
- "valid_duration": "P3Y6M4DT12H30M5S",
- "regions": [
- {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "usage_limit": 100,
- "usage_count": 50,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Updates a Discount with a given set of rules that define how the Discount behaves.
| id required | string The ID of the Discount. |
| expand | string (Comma separated) Which fields should be expanded in each item of the result. |
| fields | string (Comma separated) Which fields should be included in each item of the result. |
| code | string A unique code that will be used to redeem the Discount |
object The Discount Rule that defines how Discounts are calculated | |
| is_disabled | boolean Whether the Discount code is disabled on creation. You will have to enable it later to make it available to Customers. |
| starts_at | string <date-time> The time at which the Discount should be available. |
| ends_at | string <date-time> The time at which the Discount should no longer be available. |
| valid_duration | string Example: "P3Y6M4DT12H30M5S" Duration the discount runs between |
| usage_limit | number Maximum times the discount can be used |
| regions | Array of strings A list of Region ids representing the Regions in which the Discount can be used. |
| metadata | object An object containing metadata of the discount |
required | object (Discount) Represents a discount that can be applied to a cart for promotional purposes. |
{- "code": "string",
- "rule": {
- "id": "string",
- "description": "string",
- "value": 0,
- "allocation": "total",
- "conditions": [
- {
- "id": null,
- "operator": null,
- "products": [ ],
- "product_types": [ ],
- "product_collections": [ ],
- "product_tags": [ ],
- "customer_groups": [ ]
}
]
}, - "is_disabled": true,
- "starts_at": "2019-08-24T14:15:22Z",
- "ends_at": "2019-08-24T14:15:22Z",
- "valid_duration": "P3Y6M4DT12H30M5S",
- "usage_limit": 0,
- "regions": [
- "string"
], - "metadata": { }
}{- "discount": {
- "id": "disc_01F0YESMW10MGHWJKZSDDMN0VN",
- "code": "10DISC",
- "is_dynamic": false,
- "rule_id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "rule": {
- "id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "type": "percentage",
- "description": "10 Percent",
- "value": 10,
- "allocation": "total",
- "conditions": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "is_disabled": false,
- "parent_discount_id": "disc_01G8ZH853YPY9B94857DY91YGW",
- "parent_discount": { },
- "starts_at": "2019-08-24T14:15:22Z",
- "ends_at": "2019-08-24T14:15:22Z",
- "valid_duration": "P3Y6M4DT12H30M5S",
- "regions": [
- {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "usage_limit": 100,
- "usage_count": 50,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Deletes a Discount.
| id required | string The ID of the Discount |
| id required | string The ID of the deleted Discount |
| object required | string Default: "discount" The type of the object that was deleted. |
| deleted required | boolean Default: true Whether the discount was deleted successfully or not. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.discounts.delete(discount_id) .then(({ id, object, deleted }) => { console.log(id); });
{- "id": "string",
- "object": "discount",
- "deleted": true
}Creates a dynamic unique code that can map to a parent Discount. This is useful if you want to automatically generate codes with the same behaviour.
| id required | string The ID of the Discount to create the dynamic code from." |
| code required | string A unique code that will be used to redeem the Discount |
| usage_limit | number Default: 1 Maximum times the discount can be used |
| metadata | object An optional set of key-value pairs to hold additional information. |
required | object (Discount) Represents a discount that can be applied to a cart for promotional purposes. |
{- "code": "string",
- "usage_limit": 1,
- "metadata": { }
}{- "discount": {
- "id": "disc_01F0YESMW10MGHWJKZSDDMN0VN",
- "code": "10DISC",
- "is_dynamic": false,
- "rule_id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "rule": {
- "id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "type": "percentage",
- "description": "10 Percent",
- "value": 10,
- "allocation": "total",
- "conditions": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "is_disabled": false,
- "parent_discount_id": "disc_01G8ZH853YPY9B94857DY91YGW",
- "parent_discount": { },
- "starts_at": "2019-08-24T14:15:22Z",
- "ends_at": "2019-08-24T14:15:22Z",
- "valid_duration": "P3Y6M4DT12H30M5S",
- "regions": [
- {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "usage_limit": 100,
- "usage_count": 50,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Deletes a dynamic code from a Discount.
| id required | string The ID of the Discount |
| code required | string The ID of the Discount |
required | object (Discount) Represents a discount that can be applied to a cart for promotional purposes. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.discounts.deleteDynamicCode(discount_id, code) .then(({ discount }) => { console.log(discount.id); });
{- "discount": {
- "id": "disc_01F0YESMW10MGHWJKZSDDMN0VN",
- "code": "10DISC",
- "is_dynamic": false,
- "rule_id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "rule": {
- "id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "type": "percentage",
- "description": "10 Percent",
- "value": 10,
- "allocation": "total",
- "conditions": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "is_disabled": false,
- "parent_discount_id": "disc_01G8ZH853YPY9B94857DY91YGW",
- "parent_discount": { },
- "starts_at": "2019-08-24T14:15:22Z",
- "ends_at": "2019-08-24T14:15:22Z",
- "valid_duration": "P3Y6M4DT12H30M5S",
- "regions": [
- {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "usage_limit": 100,
- "usage_count": 50,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Adds a Region to the list of Regions that a Discount can be used in.
| id required | string The ID of the Discount. |
| region_id required | string The ID of the Region. |
required | object (Discount) Represents a discount that can be applied to a cart for promotional purposes. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.discounts.addRegion(discount_id, region_id) .then(({ discount }) => { console.log(discount.id); });
{- "discount": {
- "id": "disc_01F0YESMW10MGHWJKZSDDMN0VN",
- "code": "10DISC",
- "is_dynamic": false,
- "rule_id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "rule": {
- "id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "type": "percentage",
- "description": "10 Percent",
- "value": 10,
- "allocation": "total",
- "conditions": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "is_disabled": false,
- "parent_discount_id": "disc_01G8ZH853YPY9B94857DY91YGW",
- "parent_discount": { },
- "starts_at": "2019-08-24T14:15:22Z",
- "ends_at": "2019-08-24T14:15:22Z",
- "valid_duration": "P3Y6M4DT12H30M5S",
- "regions": [
- {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "usage_limit": 100,
- "usage_count": 50,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Removes a Region from the list of Regions that a Discount can be used in.
| id required | string The ID of the Discount. |
| region_id required | string The ID of the Region. |
required | object (Discount) Represents a discount that can be applied to a cart for promotional purposes. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.discounts.removeRegion(discount_id, region_id) .then(({ discount }) => { console.log(discount.id); });
{- "discount": {
- "id": "disc_01F0YESMW10MGHWJKZSDDMN0VN",
- "code": "10DISC",
- "is_dynamic": false,
- "rule_id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "rule": {
- "id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "type": "percentage",
- "description": "10 Percent",
- "value": 10,
- "allocation": "total",
- "conditions": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "is_disabled": false,
- "parent_discount_id": "disc_01G8ZH853YPY9B94857DY91YGW",
- "parent_discount": { },
- "starts_at": "2019-08-24T14:15:22Z",
- "ends_at": "2019-08-24T14:15:22Z",
- "valid_duration": "P3Y6M4DT12H30M5S",
- "regions": [
- {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "usage_limit": 100,
- "usage_count": 50,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Retrieves an list of Draft Orders
| offset | number Default: "0" The number of items to skip before the results. |
| limit | number Default: "50" Limit the number of items returned. |
| q | string a search term to search emails in carts associated with draft orders and display IDs of draft orders |
required | Array of objects (DraftOrder) |
| count required | integer The total number of items available |
| offset required | integer The number of items skipped before these items |
| limit required | integer The number of items per page |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.draftOrders.list() .then(({ draft_orders, limit, offset, count }) => { console.log(draft_orders.length); });
{- "draft_orders": [
- {
- "id": "dorder_01G8TJFKBG38YYFQ035MSVG03C",
- "status": "open",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "canceled_at": "2019-08-24T14:15:22Z",
- "completed_at": "2019-08-24T14:15:22Z",
- "no_notification_order": false,
- "idempotency_key": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}Creates a Draft Order
| email required | string <email> The email of the customer of the draft order |
| region_id required | string The ID of the region for the draft order |
required | Array of objects The shipping methods for the draft order |
| status | string Enum: "open" "completed" The status of the draft order |
AddressPayload (object) or string The Address to be used for billing purposes. | |
AddressPayload (object) or string The Address to be used for shipping. | |
Array of objects The Line Items that have been received. | |
Array of objects The discounts to add on the draft order | |
| customer_id | string The ID of the customer to add on the draft order |
| no_notification_order | boolean An optional flag passed to the resulting order to determine use of notifications. |
| metadata | object The optional key-value map with additional details about the Draft Order. |
required | object (DraftOrder) Represents a draft order |
{- "status": "open",
- "email": "user@example.com",
- "billing_address": {
- "first_name": "Arno",
- "last_name": "Willms",
- "phone": 16128234334802,
- "company": "string",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "province": "Kentucky",
- "postal_code": 72093,
- "metadata": {
- "car": "white"
}
}, - "shipping_address": {
- "first_name": "Arno",
- "last_name": "Willms",
- "phone": 16128234334802,
- "company": "string",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "province": "Kentucky",
- "postal_code": 72093,
- "metadata": {
- "car": "white"
}
}, - "items": [
- {
- "variant_id": "string",
- "unit_price": 0,
- "title": "string",
- "quantity": 0,
- "metadata": { }
}
], - "region_id": "string",
- "discounts": [
- {
- "code": "string"
}
], - "customer_id": "string",
- "no_notification_order": true,
- "shipping_methods": [
- {
- "option_id": "string",
- "data": { },
- "price": 0
}
], - "metadata": { }
}{- "draft_order": {
- "id": "dorder_01G8TJFKBG38YYFQ035MSVG03C",
- "status": "open",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "canceled_at": "2019-08-24T14:15:22Z",
- "completed_at": "2019-08-24T14:15:22Z",
- "no_notification_order": false,
- "idempotency_key": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Retrieves a Draft Order.
| id required | string The ID of the Draft Order. |
required | object (DraftOrder) Represents a draft order |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.draftOrders.retrieve(draft_order_id) .then(({ draft_order }) => { console.log(draft_order.id); });
{- "draft_order": {
- "id": "dorder_01G8TJFKBG38YYFQ035MSVG03C",
- "status": "open",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "canceled_at": "2019-08-24T14:15:22Z",
- "completed_at": "2019-08-24T14:15:22Z",
- "no_notification_order": false,
- "idempotency_key": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Updates a Draft Order.
| id required | string The ID of the Draft Order. |
| region_id | string The ID of the Region to create the Draft Order in. |
| country_code | |
string <email> An email to be used on the Draft Order. | |
AddressPayload (object) or string The Address to be used for billing purposes. | |
AddressPayload (object) or string The Address to be used for shipping. | |
Array of objects An array of Discount codes to add to the Draft Order. | |
| no_notification_order | boolean An optional flag passed to the resulting order to determine use of notifications. |
| customer_id | string The ID of the Customer to associate the Draft Order with. |
required | object (DraftOrder) Represents a draft order |
{- "region_id": "string",
- "country_code": "string",
- "email": "user@example.com",
- "billing_address": {
- "first_name": "Arno",
- "last_name": "Willms",
- "phone": 16128234334802,
- "company": "string",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "province": "Kentucky",
- "postal_code": 72093,
- "metadata": {
- "car": "white"
}
}, - "shipping_address": {
- "first_name": "Arno",
- "last_name": "Willms",
- "phone": 16128234334802,
- "company": "string",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "province": "Kentucky",
- "postal_code": 72093,
- "metadata": {
- "car": "white"
}
}, - "discounts": [
- {
- "code": "string"
}
], - "no_notification_order": true,
- "customer_id": "string"
}{- "draft_order": {
- "id": "dorder_01G8TJFKBG38YYFQ035MSVG03C",
- "status": "open",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "canceled_at": "2019-08-24T14:15:22Z",
- "completed_at": "2019-08-24T14:15:22Z",
- "no_notification_order": false,
- "idempotency_key": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Deletes a Draft Order
| id required | string The ID of the Draft Order. |
| id required | string The ID of the deleted Draft Order. |
| object required | string Default: "draft-order" The type of the object that was deleted. |
| deleted required | boolean Default: true Whether the draft order was deleted successfully or not. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.draftOrders.delete(draft_order_id) .then(({ id, object, deleted }) => { console.log(id); });
{- "id": "string",
- "object": "draft-order",
- "deleted": true
}Creates a Line Item for the Draft Order
| id required | string The ID of the Draft Order. |
| quantity required | integer The quantity of the Line Item. |
| variant_id | string The ID of the Product Variant to generate the Line Item from. |
| unit_price | integer The potential custom price of the item. |
| title | string Default: "Custom item" The potential custom title of the item. |
| metadata | object The optional key-value map with additional details about the Line Item. |
required | object (DraftOrder) Represents a draft order |
{- "variant_id": "string",
- "unit_price": 0,
- "title": "Custom item",
- "quantity": 0,
- "metadata": { }
}{- "draft_order": {
- "id": "dorder_01G8TJFKBG38YYFQ035MSVG03C",
- "status": "open",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "canceled_at": "2019-08-24T14:15:22Z",
- "completed_at": "2019-08-24T14:15:22Z",
- "no_notification_order": false,
- "idempotency_key": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Updates a Line Item for a Draft Order
| id required | string The ID of the Draft Order. |
| line_id required | string The ID of the Line Item. |
| unit_price | integer The potential custom price of the item. |
| title | string The potential custom title of the item. |
| quantity | integer The quantity of the Line Item. |
| metadata | object The optional key-value map with additional details about the Line Item. |
required | object (DraftOrder) Represents a draft order |
{- "unit_price": 0,
- "title": "string",
- "quantity": 0,
- "metadata": { }
}{- "draft_order": {
- "id": "dorder_01G8TJFKBG38YYFQ035MSVG03C",
- "status": "open",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "canceled_at": "2019-08-24T14:15:22Z",
- "completed_at": "2019-08-24T14:15:22Z",
- "no_notification_order": false,
- "idempotency_key": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Removes a Line Item from a Draft Order.
| id required | string The ID of the Draft Order. |
| line_id required | string The ID of the Draft Order. |
required | object (DraftOrder) Represents a draft order |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.draftOrders.removeLineItem(draft_order_id, item_id) .then(({ draft_order }) => { console.log(draft_order.id); });
{- "draft_order": {
- "id": "dorder_01G8TJFKBG38YYFQ035MSVG03C",
- "status": "open",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "canceled_at": "2019-08-24T14:15:22Z",
- "completed_at": "2019-08-24T14:15:22Z",
- "no_notification_order": false,
- "idempotency_key": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Registers a payment for a Draft Order.
| id required | string The Draft Order id. |
required | object (Order) Represents an order |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.draftOrders.markPaid(draft_order_id) .then(({ order }) => { console.log(order.id); });
{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Retrieves a list of Gift Cards.
| offset | number Default: "0" The number of items to skip before the results. |
| limit | number Default: "50" Limit the number of items returned. |
| q | string a search term to search by code or display ID |
required | Array of objects (Gift Card) |
| count required | integer The total number of items available |
| offset required | integer The number of items skipped before these items |
| limit required | integer The number of items per page |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.giftCards.list() .then(({ gift_cards, limit, offset, count }) => { console.log(gift_cards.length); });
{- "gift_cards": [
- {
- "id": "gift_01G8XKBPBQY2R7RBET4J7E0XQZ",
- "code": "3RFT-MH2C-Y4YZ-XMN4",
- "value": 10,
- "balance": 10,
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "is_disabled": false,
- "ends_at": "2019-08-24T14:15:22Z",
- "tax_rate": 0,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}Creates a Gift Card that can redeemed by its unique code. The Gift Card is only valid within 1 region.
| region_id required | string The ID of the Region in which the Gift Card can be used. |
| value | integer The value (excluding VAT) that the Gift Card should represent. |
| is_disabled | boolean Whether the Gift Card is disabled on creation. You will have to enable it later to make it available to Customers. |
| ends_at | string <date-time> The time at which the Gift Card should no longer be available. |
| metadata | object An optional set of key-value pairs to hold additional information. |
required | object (Gift Card) Gift Cards are redeemable and represent a value that can be used towards the payment of an Order. |
{- "value": 0,
- "is_disabled": true,
- "ends_at": "2019-08-24T14:15:22Z",
- "region_id": "string",
- "metadata": { }
}{- "gift_card": {
- "id": "gift_01G8XKBPBQY2R7RBET4J7E0XQZ",
- "code": "3RFT-MH2C-Y4YZ-XMN4",
- "value": 10,
- "balance": 10,
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "is_disabled": false,
- "ends_at": "2019-08-24T14:15:22Z",
- "tax_rate": 0,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Retrieves a Gift Card.
| id required | string The ID of the Gift Card. |
required | object (Gift Card) Gift Cards are redeemable and represent a value that can be used towards the payment of an Order. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.giftCards.retrieve(gift_card_id) .then(({ gift_card }) => { console.log(gift_card.id); });
{- "gift_card": {
- "id": "gift_01G8XKBPBQY2R7RBET4J7E0XQZ",
- "code": "3RFT-MH2C-Y4YZ-XMN4",
- "value": 10,
- "balance": 10,
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "is_disabled": false,
- "ends_at": "2019-08-24T14:15:22Z",
- "tax_rate": 0,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Update a Gift Card that can redeemed by its unique code. The Gift Card is only valid within 1 region.
| id required | string The ID of the Gift Card. |
| balance | integer The value (excluding VAT) that the Gift Card should represent. |
| is_disabled | boolean Whether the Gift Card is disabled on creation. You will have to enable it later to make it available to Customers. |
| ends_at | string <date-time> The time at which the Gift Card should no longer be available. |
| region_id | string The ID of the Region in which the Gift Card can be used. |
| metadata | object An optional set of key-value pairs to hold additional information. |
required | object (Gift Card) Gift Cards are redeemable and represent a value that can be used towards the payment of an Order. |
{- "balance": 0,
- "is_disabled": true,
- "ends_at": "2019-08-24T14:15:22Z",
- "region_id": "string",
- "metadata": { }
}{- "gift_card": {
- "id": "gift_01G8XKBPBQY2R7RBET4J7E0XQZ",
- "code": "3RFT-MH2C-Y4YZ-XMN4",
- "value": 10,
- "balance": 10,
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "is_disabled": false,
- "ends_at": "2019-08-24T14:15:22Z",
- "tax_rate": 0,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Deletes a Gift Card
| id required | string The ID of the Gift Card to delete. |
| id required | string The ID of the deleted Gift Card |
| object required | string Default: "gift-card" The type of the object that was deleted. |
| deleted required | boolean Default: true Whether the gift card was deleted successfully or not. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.giftCards.delete(gift_card_id) .then(({ id, object, deleted }) => { console.log(id); });
{- "id": "string",
- "object": "gift-card",
- "deleted": true
}Lists inventory items with the ability to apply filters or search queries on them.
| offset | integer Default: 0 How many inventory items to skip in the result. |
| limit | integer Default: 20 Limit the number of inventory items returned. |
| expand | string Comma separated list of relations to include in the results. |
| fields | string Comma separated list of fields to include in the results. |
| q | string Query used for searching product inventory items and their properties. |
| location_id | Array of strings Locations ids to search for. |
| id | string id to search for. |
| sku | string sku to search for. |
| origin_country | string origin_country to search for. |
| mid_code | string mid_code to search for. |
| material | string material to search for. |
| hs_code | string hs_code to search for. |
| weight | string weight to search for. |
| length | string length to search for. |
| height | string height to search for. |
| width | string width to search for. |
| requires_shipping | string requires_shipping to search for. |
required | Array of objects |
| count required | integer The total number of items available |
| offset required | integer The number of items skipped before these items |
| limit required | integer The number of items per page |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.inventoryItems.list() .then(({ inventory_items, count, offset, limit }) => { console.log(inventory_items.length); });
{- "inventory_items": [
- {
- "sku": "string",
- "hs_code": "string",
- "origin_country": "string",
- "mid_code": "string",
- "title": "string",
- "description": "string",
- "thumbnail": "string",
- "material": "string",
- "weight": 0,
- "height": 0,
- "width": 0,
- "length": 0,
- "requires_shipping": true,
- "metadata": {
- "car": "white"
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "location_levels": [
- null
], - "variants": [
- null
]
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}Creates an Inventory Item.
| expand | string Comma separated list of relations to include in the results. |
| fields | string Comma separated list of fields to include in the results. |
| sku | string The unique SKU for the Product Variant. |
| ean | string The EAN number of the item. |
| upc | string The UPC number of the item. |
| barcode | string A generic GTIN field for the Product Variant. |
| hs_code | string The Harmonized System code for the Product Variant. |
| inventory_quantity | integer Default: 0 The amount of stock kept for the Product Variant. |
| allow_backorder | boolean Whether the Product Variant can be purchased when out of stock. |
| manage_inventory | boolean Default: true Whether Medusa should keep track of the inventory for this Product Variant. |
| weight | number The wieght of the Product Variant. |
| length | number The length of the Product Variant. |
| height | number The height of the Product Variant. |
| width | number The width of the Product Variant. |
| origin_country | string The country of origin of the Product Variant. |
| mid_code | string The Manufacturer Identification code for the Product Variant. |
| material | string The material composition of the Product Variant. |
| metadata | object An optional set of key-value pairs with additional information. |
required | object (InventoryItemDTO) |
{- "sku": "string",
- "ean": "string",
- "upc": "string",
- "barcode": "string",
- "hs_code": "string",
- "inventory_quantity": 0,
- "allow_backorder": true,
- "manage_inventory": true,
- "weight": 0,
- "length": 0,
- "height": 0,
- "width": 0,
- "origin_country": "string",
- "mid_code": "string",
- "material": "string",
- "metadata": { }
}{- "inventory_item": {
- "sku": "string",
- "hs_code": "string",
- "origin_country": "string",
- "mid_code": "string",
- "title": "string",
- "description": "string",
- "thumbnail": "string",
- "material": "string",
- "weight": 0,
- "height": 0,
- "width": 0,
- "length": 0,
- "requires_shipping": true,
- "metadata": {
- "car": "white"
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}Retrieves an Inventory Item.
| id required | string The ID of the Inventory Item. |
| expand | string Comma separated list of relations to include in the results. |
| fields | string Comma separated list of fields to include in the results. |
required | object (InventoryItemDTO) |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.inventoryItems.retrieve(inventoryItemId) .then(({ inventory_item }) => { console.log(inventory_item.id); });
{- "inventory_item": {
- "sku": "string",
- "hs_code": "string",
- "origin_country": "string",
- "mid_code": "string",
- "title": "string",
- "description": "string",
- "thumbnail": "string",
- "material": "string",
- "weight": 0,
- "height": 0,
- "width": 0,
- "length": 0,
- "requires_shipping": true,
- "metadata": {
- "car": "white"
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}Updates an Inventory Item.
| id required | string The ID of the Inventory Item. |
| expand | string Comma separated list of relations to include in the results. |
| fields | string Comma separated list of fields to include in the results. |
| hs_code | string The Harmonized System code of the Inventory Item. May be used by Fulfillment Providers to pass customs information to shipping carriers. |
| origin_country | string The country in which the Inventory Item was produced. May be used by Fulfillment Providers to pass customs information to shipping carriers. |
| mid_code | string The Manufacturers Identification code that identifies the manufacturer of the Inventory Item. May be used by Fulfillment Providers to pass customs information to shipping carriers. |
| material | string The material and composition that the Inventory Item is made of, May be used by Fulfillment Providers to pass customs information to shipping carriers. |
| weight | number The weight of the Inventory Item. May be used in shipping rate calculations. |
| height | number The height of the Inventory Item. May be used in shipping rate calculations. |
| width | number The width of the Inventory Item. May be used in shipping rate calculations. |
| length | number The length of the Inventory Item. May be used in shipping rate calculations. |
| requires_shipping | boolean Whether the item requires shipping. |
required | object (InventoryItemDTO) |
{- "hs_code": "string",
- "origin_country": "string",
- "mid_code": "string",
- "material": "string",
- "weight": 0,
- "height": 0,
- "width": 0,
- "length": 0,
- "requires_shipping": true
}{- "inventory_item": {
- "sku": "string",
- "hs_code": "string",
- "origin_country": "string",
- "mid_code": "string",
- "title": "string",
- "description": "string",
- "thumbnail": "string",
- "material": "string",
- "weight": 0,
- "height": 0,
- "width": 0,
- "length": 0,
- "requires_shipping": true,
- "metadata": {
- "car": "white"
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}Delete an Inventory Item
| id required | string The ID of the Inventory Item to delete. |
| id required | string The ID of the deleted Inventory Item. |
| object required | string <inventory_item> The type of the object that was deleted. |
| deleted required | boolean Default: true Whether or not the Inventory Item was deleted. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.inventoryItems.delete(inventoryItemId) .then(({ id, object, deleted }) => { console.log(id) })
{- "id": "string",
- "object": "string",
- "deleted": true
}Lists inventory levels of an inventory item.
| id required | string The ID of the Inventory Item. |
| expand | string Comma separated list of relations to include in the results. |
| fields | string Comma separated list of fields to include in the results. |
required | object |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.inventoryItems.listLocationLevels(inventoryItemId) .then(({ inventory_item }) => { console.log(inventory_item.location_levels); });
{- "inventory_item": {
- "id": null,
- "location_levels": [
- {
- "location_id": null,
- "stocked_quantity": null,
- "reserved_quantity": null,
- "incoming_quantity": null,
- "metadata": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
]
}
}Creates an Inventory Level for a given Inventory Item.
| id required | string The ID of the Inventory Item. |
| expand | string Comma separated list of relations to include in the results. |
| fields | string Comma separated list of fields to include in the results. |
| location_id required | string the item location ID |
| stocked_quantity required | number the stock quantity of an inventory item at the given location ID |
| incoming_quantity | number the incoming stock quantity of an inventory item at the given location ID |
required | object (InventoryItemDTO) |
{- "location_id": "string",
- "stocked_quantity": 0,
- "incoming_quantity": 0
}{- "inventory_item": {
- "sku": "string",
- "hs_code": "string",
- "origin_country": "string",
- "mid_code": "string",
- "title": "string",
- "description": "string",
- "thumbnail": "string",
- "material": "string",
- "weight": 0,
- "height": 0,
- "width": 0,
- "length": 0,
- "requires_shipping": true,
- "metadata": {
- "car": "white"
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}Updates an Inventory Level for a given Inventory Item.
| id required | string The ID of the Inventory Item. |
| location_id required | string The ID of the Location. |
| expand | string Comma separated list of relations to include in the results. |
| fields | string Comma separated list of fields to include in the results. |
| stocked_quantity | number the total stock quantity of an inventory item at the given location ID |
| incoming_quantity | number the incoming stock quantity of an inventory item at the given location ID |
required | object (InventoryItemDTO) |
{- "stocked_quantity": 0,
- "incoming_quantity": 0
}{- "inventory_item": {
- "sku": "string",
- "hs_code": "string",
- "origin_country": "string",
- "mid_code": "string",
- "title": "string",
- "description": "string",
- "thumbnail": "string",
- "material": "string",
- "weight": 0,
- "height": 0,
- "width": 0,
- "length": 0,
- "requires_shipping": true,
- "metadata": {
- "car": "white"
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}Delete a location level of an Inventory Item.
| id required | string The ID of the Inventory Item. |
| location_id required | string The ID of the location. |
required | object (InventoryItemDTO) |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.inventoryItems.deleteLocationLevel(inventoryItemId, locationId) .then(({ inventory_item }) => { console.log(inventory_item.id); });
{- "inventory_item": {
- "sku": "string",
- "hs_code": "string",
- "origin_country": "string",
- "mid_code": "string",
- "title": "string",
- "description": "string",
- "thumbnail": "string",
- "material": "string",
- "weight": 0,
- "height": 0,
- "width": 0,
- "length": 0,
- "requires_shipping": true,
- "metadata": {
- "car": "white"
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}Lists all Invites
required | Array of objects (Invite) |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.invites.list() .then(({ invites }) => { console.log(invites.length); });
{- "invites": [
- {
- "id": "invite_01G8TKE4XYCTHSCK2GDEP47RE1",
- "user_email": "user@example.com",
- "role": "admin",
- "accepted": false,
- "token": "string",
- "expires_at": "2019-08-24T14:15:22Z",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
]
}Creates an Invite and triggers an 'invite' created event
| user required | string <email> The email for the user to be created. |
| role required | string Enum: "admin" "member" "developer" The role of the user to be created. |
{- "user": "user@example.com",
- "role": "admin"
}{- "message": "Discount must be set to dynamic",
- "type": "not_allowed"
}Accepts an Invite and creates a corresponding user
| token required | string The invite token provided by the admin. |
required | object The User to create. |
{- "token": "string",
- "user": {
- "first_name": "string",
- "last_name": "string",
- "password": "pa$$word"
}
}{- "message": "Discount must be set to dynamic",
- "type": "not_allowed"
}Deletes an Invite
| invite_id required | string The ID of the Invite |
| id required | string The ID of the deleted Invite. |
| object required | string Default: "invite" The type of the object that was deleted. |
| deleted required | boolean Default: true Whether or not the Invite was deleted. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.invites.delete(invite_id) .then(({ id, object, deleted }) => { console.log(id); });
{- "id": "string",
- "object": "invite",
- "deleted": true
}Resends an Invite by triggering the 'invite' created event again
| invite_id required | string The ID of the Invite |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.invites.resend(invite_id) .then(() => { // successful }) .catch(() => { // an error occurred });
{- "message": "Discount must be set to dynamic",
- "type": "not_allowed"
}Retrieves a list of notes
| limit | number Default: "50" The number of notes to get |
| offset | number Default: "0" The offset at which to get notes |
| resource_id | string The ID which the notes belongs to |
required | Array of objects (Note) |
| count required | integer The total number of items available |
| offset required | integer The number of items skipped before these items |
| limit required | integer The number of items per page |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.notes.list() .then(({ notes, limit, offset, count }) => { console.log(notes.length); });
{- "notes": [
- {
- "id": "note_01G8TM8ENBMC7R90XRR1G6H26Q",
- "resource_type": "order",
- "resource_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "value": "This order must be fulfilled on Monday",
- "author_id": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "author": {
- "id": null,
- "role": null,
- "email": null,
- "first_name": null,
- "last_name": null,
- "api_token": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}Creates a Note which can be associated with any resource as required.
| resource_id required | string The ID of the resource which the Note relates to. |
| resource_type required | string The type of resource which the Note relates to. |
| value required | string The content of the Note to create. |
required | object (Note) Notes are elements which we can use in association with different resources to allow users to describe additional information in relation to these. |
{- "resource_id": "string",
- "resource_type": "string",
- "value": "string"
}{- "note": {
- "id": "note_01G8TM8ENBMC7R90XRR1G6H26Q",
- "resource_type": "order",
- "resource_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "value": "This order must be fulfilled on Monday",
- "author_id": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "author": {
- "id": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "role": "admin",
- "email": "user@example.com",
- "first_name": "Levi",
- "last_name": "Bogan",
- "api_token": null,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Retrieves a single note using its id
| id required | string The ID of the note to retrieve. |
required | object (Note) Notes are elements which we can use in association with different resources to allow users to describe additional information in relation to these. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.notes.retrieve(note_id) .then(({ note }) => { console.log(note.id); });
{- "note": {
- "id": "note_01G8TM8ENBMC7R90XRR1G6H26Q",
- "resource_type": "order",
- "resource_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "value": "This order must be fulfilled on Monday",
- "author_id": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "author": {
- "id": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "role": "admin",
- "email": "user@example.com",
- "first_name": "Levi",
- "last_name": "Bogan",
- "api_token": null,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Updates a Note associated with some resource
| id required | string The ID of the Note to update |
| value required | string The updated description of the Note. |
required | object (Note) Notes are elements which we can use in association with different resources to allow users to describe additional information in relation to these. |
{- "value": "string"
}{- "note": {
- "id": "note_01G8TM8ENBMC7R90XRR1G6H26Q",
- "resource_type": "order",
- "resource_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "value": "This order must be fulfilled on Monday",
- "author_id": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "author": {
- "id": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "role": "admin",
- "email": "user@example.com",
- "first_name": "Levi",
- "last_name": "Bogan",
- "api_token": null,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Deletes a Note.
| id required | string The ID of the Note to delete. |
| id required | string The ID of the deleted Note. |
| object required | string Default: "note" The type of the object that was deleted. |
| deleted required | boolean Default: true Whether or not the Note was deleted. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.notes.delete(note_id) .then(({ id, object, deleted }) => { console.log(id); });
{- "id": "string",
- "object": "note",
- "deleted": true
}Retrieves a list of Notifications.
| offset | integer Default: 0 The number of notifications to skip before starting to collect the notifications set |
| limit | integer Default: 50 The number of notifications to return |
| fields | string Comma separated fields to include in the result set |
| expand | string Comma separated fields to populate |
| event_name | string The name of the event that the notification was sent for. |
| resource_type | string The type of resource that the Notification refers to. |
| resource_id | string The ID of the resource that the Notification refers to. |
| to | string The address that the Notification was sent to. This will usually be an email address, but represent other addresses such as a chat bot user id |
| include_resends | string A boolean indicating whether the result set should include resent notifications or not |
required | Array of objects (Notification) |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.notifications.list() .then(({ notifications }) => { console.log(notifications.length); });
{- "notifications": [
- {
- "id": "noti_01G53V9Y6CKMCGBM1P0X7C28RX",
- "event_name": "order.placed",
- "resource_type": "order",
- "resource_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": {
- "id": null,
- "email": null,
- "first_name": null,
- "last_name": null,
- "billing_address_id": null,
- "billing_address": null,
- "shipping_addresses": [ ],
- "phone": null,
- "has_account": null,
- "orders": [ ],
- "groups": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "to": "user@example.com",
- "data": { },
- "parent_id": "noti_01G53V9Y6CKMCGBM1P0X7C28RX",
- "parent_notification": { },
- "resends": [
- { }
], - "provider_id": "sengrid",
- "provider": {
- "id": null,
- "is_installed": null
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
]
}Resends a previously sent notifications, with the same data but optionally to a different address
| id required | string The ID of the Notification |
| to | string A new address or user identifier that the Notification should be sent to |
required | object (Notification) Notifications a communications sent via Notification Providers as a reaction to internal events such as |
{- "to": "string"
}{- "notification": {
- "id": "noti_01G53V9Y6CKMCGBM1P0X7C28RX",
- "event_name": "order.placed",
- "resource_type": "order",
- "resource_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": {
- "id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "email": "user@example.com",
- "first_name": "Arno",
- "last_name": "Willms",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": null,
- "customer_id": null,
- "customer": { },
- "company": null,
- "first_name": null,
- "last_name": null,
- "address_1": null,
- "address_2": null,
- "city": null,
- "country_code": null,
- "country": null,
- "province": null,
- "postal_code": null,
- "phone": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "shipping_addresses": [
- null
], - "phone": 16128234334802,
- "has_account": false,
- "orders": [
- { }
], - "groups": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "to": "user@example.com",
- "data": { },
- "parent_id": "noti_01G53V9Y6CKMCGBM1P0X7C28RX",
- "parent_notification": { },
- "resends": [
- { }
], - "provider_id": "sengrid",
- "provider": {
- "id": "sendgrid",
- "is_installed": true
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}List OrderEdits.
| q | string Query used for searching order edit internal note. |
| order_id | string List order edits by order id. |
| limit | number Default: "20" The number of items in the response |
| offset | number Default: "0" The offset of items in response |
| expand | string Comma separated list of relations to include in the results. |
| fields | string Comma separated list of fields to include in the results. |
required | Array of objects (Order Edit) |
| count required | integer The total number of items available |
| offset required | integer The number of items skipped before these items |
| limit required | integer The number of items per page |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.orderEdits.list() .then(({ order_edits, count, limit, offset }) => { console.log(order_edits.length) })
{- "order_edits": [
- {
- "id": "oe_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order_id": "order_01G2SG30J8C85S4A5CHM2S1NS2",
- "order": { },
- "changes": [
- null
], - "internal_note": "Included two more items B to the order.",
- "created_by": "string",
- "requested_by": "string",
- "requested_at": "2019-08-24T14:15:22Z",
- "confirmed_by": "string",
- "confirmed_at": "2019-08-24T14:15:22Z",
- "declined_by": "string",
- "declined_at": "2019-08-24T14:15:22Z",
- "declined_reason": "string",
- "canceled_by": "string",
- "canceled_at": "2019-08-24T14:15:22Z",
- "subtotal": 8000,
- "discount_total": 800,
- "shipping_total": 800,
- "gift_card_total": 800,
- "gift_card_tax_total": 800,
- "tax_total": 0,
- "total": 8200,
- "difference_due": 8200,
- "status": "confirmed",
- "items": [
- null
], - "payment_collection_id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "payment_collection": {
- "id": null,
- "type": null,
- "status": null,
- "description": null,
- "amount": null,
- "authorized_amount": null,
- "region_id": null,
- "region": null,
- "currency_code": null,
- "currency": null,
- "payment_sessions": [ ],
- "payments": [ ],
- "created_by": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}Creates an OrderEdit.
| order_id required | string The ID of the order to create the edit for. |
| internal_note | string An optional note to create for the order edit. |
required | object (Order Edit) Order edit keeps track of order items changes. |
{- "order_id": "string",
- "internal_note": "string"
}{- "order_edit": {
- "id": "oe_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order_id": "order_01G2SG30J8C85S4A5CHM2S1NS2",
- "order": { },
- "changes": [
- {
- "id": null,
- "type": null,
- "order_edit_id": null,
- "order_edit": { },
- "original_line_item_id": null,
- "original_line_item": null,
- "line_item_id": null,
- "line_item": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "internal_note": "Included two more items B to the order.",
- "created_by": "string",
- "requested_by": "string",
- "requested_at": "2019-08-24T14:15:22Z",
- "confirmed_by": "string",
- "confirmed_at": "2019-08-24T14:15:22Z",
- "declined_by": "string",
- "declined_at": "2019-08-24T14:15:22Z",
- "declined_reason": "string",
- "canceled_by": "string",
- "canceled_at": "2019-08-24T14:15:22Z",
- "subtotal": 8000,
- "discount_total": 800,
- "shipping_total": 800,
- "gift_card_total": 800,
- "gift_card_tax_total": 800,
- "tax_total": 0,
- "total": 8200,
- "difference_due": 8200,
- "status": "confirmed",
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "payment_collection_id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "payment_collection": {
- "id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "type": "order_edit",
- "status": "not_paid",
- "description": "string",
- "amount": 0,
- "authorized_amount": 0,
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "payment_sessions": [
- null
], - "payments": [
- null
], - "created_by": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}Retrieves a OrderEdit.
| id required | string The ID of the OrderEdit. |
| expand | string Comma separated list of relations to include in the results. |
| fields | string Comma separated list of fields to include in the results. |
required | object (Order Edit) Order edit keeps track of order items changes. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.orderEdits.retrieve(orderEditId) .then(({ order_edit }) => { console.log(order_edit.id) })
{- "order_edit": {
- "id": "oe_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order_id": "order_01G2SG30J8C85S4A5CHM2S1NS2",
- "order": { },
- "changes": [
- {
- "id": null,
- "type": null,
- "order_edit_id": null,
- "order_edit": { },
- "original_line_item_id": null,
- "original_line_item": null,
- "line_item_id": null,
- "line_item": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "internal_note": "Included two more items B to the order.",
- "created_by": "string",
- "requested_by": "string",
- "requested_at": "2019-08-24T14:15:22Z",
- "confirmed_by": "string",
- "confirmed_at": "2019-08-24T14:15:22Z",
- "declined_by": "string",
- "declined_at": "2019-08-24T14:15:22Z",
- "declined_reason": "string",
- "canceled_by": "string",
- "canceled_at": "2019-08-24T14:15:22Z",
- "subtotal": 8000,
- "discount_total": 800,
- "shipping_total": 800,
- "gift_card_total": 800,
- "gift_card_tax_total": 800,
- "tax_total": 0,
- "total": 8200,
- "difference_due": 8200,
- "status": "confirmed",
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "payment_collection_id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "payment_collection": {
- "id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "type": "order_edit",
- "status": "not_paid",
- "description": "string",
- "amount": 0,
- "authorized_amount": 0,
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "payment_sessions": [
- null
], - "payments": [
- null
], - "created_by": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}Updates a OrderEdit.
| id required | string The ID of the OrderEdit. |
| internal_note | string An optional note to create or update for the order edit. |
required | object (Order Edit) Order edit keeps track of order items changes. |
{- "internal_note": "string"
}{- "order_edit": {
- "id": "oe_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order_id": "order_01G2SG30J8C85S4A5CHM2S1NS2",
- "order": { },
- "changes": [
- {
- "id": null,
- "type": null,
- "order_edit_id": null,
- "order_edit": { },
- "original_line_item_id": null,
- "original_line_item": null,
- "line_item_id": null,
- "line_item": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "internal_note": "Included two more items B to the order.",
- "created_by": "string",
- "requested_by": "string",
- "requested_at": "2019-08-24T14:15:22Z",
- "confirmed_by": "string",
- "confirmed_at": "2019-08-24T14:15:22Z",
- "declined_by": "string",
- "declined_at": "2019-08-24T14:15:22Z",
- "declined_reason": "string",
- "canceled_by": "string",
- "canceled_at": "2019-08-24T14:15:22Z",
- "subtotal": 8000,
- "discount_total": 800,
- "shipping_total": 800,
- "gift_card_total": 800,
- "gift_card_tax_total": 800,
- "tax_total": 0,
- "total": 8200,
- "difference_due": 8200,
- "status": "confirmed",
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "payment_collection_id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "payment_collection": {
- "id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "type": "order_edit",
- "status": "not_paid",
- "description": "string",
- "amount": 0,
- "authorized_amount": 0,
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "payment_sessions": [
- null
], - "payments": [
- null
], - "created_by": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}Delete an Order Edit
| id required | string The ID of the Order Edit to delete. |
| id required | string The ID of the deleted Order Edit. |
| object required | string Default: "order_edit" The type of the object that was deleted. |
| deleted required | boolean Default: true Whether or not the Order Edit was deleted. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.orderEdits.delete(order_edit_id) .then(({ id, object, deleted }) => { console.log(id) })
{- "id": "string",
- "object": "order_edit",
- "deleted": true
}Cancels an OrderEdit.
| id required | string The ID of the OrderEdit. |
required | object (Order Edit) Order edit keeps track of order items changes. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.orderEdits.cancel(order_edit_id) .then(({ order_edit }) => { console.log(order_edit.id) })
{- "order_edit": {
- "id": "oe_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order_id": "order_01G2SG30J8C85S4A5CHM2S1NS2",
- "order": { },
- "changes": [
- {
- "id": null,
- "type": null,
- "order_edit_id": null,
- "order_edit": { },
- "original_line_item_id": null,
- "original_line_item": null,
- "line_item_id": null,
- "line_item": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "internal_note": "Included two more items B to the order.",
- "created_by": "string",
- "requested_by": "string",
- "requested_at": "2019-08-24T14:15:22Z",
- "confirmed_by": "string",
- "confirmed_at": "2019-08-24T14:15:22Z",
- "declined_by": "string",
- "declined_at": "2019-08-24T14:15:22Z",
- "declined_reason": "string",
- "canceled_by": "string",
- "canceled_at": "2019-08-24T14:15:22Z",
- "subtotal": 8000,
- "discount_total": 800,
- "shipping_total": 800,
- "gift_card_total": 800,
- "gift_card_tax_total": 800,
- "tax_total": 0,
- "total": 8200,
- "difference_due": 8200,
- "status": "confirmed",
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "payment_collection_id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "payment_collection": {
- "id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "type": "order_edit",
- "status": "not_paid",
- "description": "string",
- "amount": 0,
- "authorized_amount": 0,
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "payment_sessions": [
- null
], - "payments": [
- null
], - "created_by": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}Deletes an Order Edit Item Change
| id required | string The ID of the Order Edit to delete. |
| change_id required | string The ID of the Order Edit Item Change to delete. |
| id required | string The ID of the deleted Order Edit Item Change. |
| object required | string Default: "item_change" The type of the object that was deleted. |
| deleted required | boolean Default: true Whether or not the Order Edit Item Change was deleted. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.orderEdits.deleteItemChange(order_edit_id, item_change_id) .then(({ id, object, deleted }) => { console.log(id) })
{- "id": "string",
- "object": "item_change",
- "deleted": true
}Confirms an OrderEdit.
| id required | string The ID of the order edit. |
required | object (Order Edit) Order edit keeps track of order items changes. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.orderEdits.confirm(order_edit_id) .then(({ order_edit }) => { console.log(order_edit.id) })
{- "order_edit": {
- "id": "oe_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order_id": "order_01G2SG30J8C85S4A5CHM2S1NS2",
- "order": { },
- "changes": [
- {
- "id": null,
- "type": null,
- "order_edit_id": null,
- "order_edit": { },
- "original_line_item_id": null,
- "original_line_item": null,
- "line_item_id": null,
- "line_item": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "internal_note": "Included two more items B to the order.",
- "created_by": "string",
- "requested_by": "string",
- "requested_at": "2019-08-24T14:15:22Z",
- "confirmed_by": "string",
- "confirmed_at": "2019-08-24T14:15:22Z",
- "declined_by": "string",
- "declined_at": "2019-08-24T14:15:22Z",
- "declined_reason": "string",
- "canceled_by": "string",
- "canceled_at": "2019-08-24T14:15:22Z",
- "subtotal": 8000,
- "discount_total": 800,
- "shipping_total": 800,
- "gift_card_total": 800,
- "gift_card_tax_total": 800,
- "tax_total": 0,
- "total": 8200,
- "difference_due": 8200,
- "status": "confirmed",
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "payment_collection_id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "payment_collection": {
- "id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "type": "order_edit",
- "status": "not_paid",
- "description": "string",
- "amount": 0,
- "authorized_amount": 0,
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "payment_sessions": [
- null
], - "payments": [
- null
], - "created_by": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}Create an OrderEdit LineItem.
| id required | string The ID of the Order Edit. |
| variant_id required | string The ID of the variant ID to add |
| quantity required | number The quantity to add |
| metadata | object An optional set of key-value pairs to hold additional information. |
required | object (Order Edit) Order edit keeps track of order items changes. |
{- "variant_id": "string",
- "quantity": 0,
- "metadata": { }
}{- "order_edit": {
- "id": "oe_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order_id": "order_01G2SG30J8C85S4A5CHM2S1NS2",
- "order": { },
- "changes": [
- {
- "id": null,
- "type": null,
- "order_edit_id": null,
- "order_edit": { },
- "original_line_item_id": null,
- "original_line_item": null,
- "line_item_id": null,
- "line_item": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "internal_note": "Included two more items B to the order.",
- "created_by": "string",
- "requested_by": "string",
- "requested_at": "2019-08-24T14:15:22Z",
- "confirmed_by": "string",
- "confirmed_at": "2019-08-24T14:15:22Z",
- "declined_by": "string",
- "declined_at": "2019-08-24T14:15:22Z",
- "declined_reason": "string",
- "canceled_by": "string",
- "canceled_at": "2019-08-24T14:15:22Z",
- "subtotal": 8000,
- "discount_total": 800,
- "shipping_total": 800,
- "gift_card_total": 800,
- "gift_card_tax_total": 800,
- "tax_total": 0,
- "total": 8200,
- "difference_due": 8200,
- "status": "confirmed",
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "payment_collection_id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "payment_collection": {
- "id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "type": "order_edit",
- "status": "not_paid",
- "description": "string",
- "amount": 0,
- "authorized_amount": 0,
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "payment_sessions": [
- null
], - "payments": [
- null
], - "created_by": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}Create or update the order edit change holding the line item changes
| id required | string The ID of the Order Edit to update. |
| item_id required | string The ID of the order edit item to update. |
| quantity required | number The quantity to update |
required | object (Order Edit) Order edit keeps track of order items changes. |
{- "quantity": 0
}{- "order_edit": {
- "id": "oe_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order_id": "order_01G2SG30J8C85S4A5CHM2S1NS2",
- "order": { },
- "changes": [
- {
- "id": null,
- "type": null,
- "order_edit_id": null,
- "order_edit": { },
- "original_line_item_id": null,
- "original_line_item": null,
- "line_item_id": null,
- "line_item": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "internal_note": "Included two more items B to the order.",
- "created_by": "string",
- "requested_by": "string",
- "requested_at": "2019-08-24T14:15:22Z",
- "confirmed_by": "string",
- "confirmed_at": "2019-08-24T14:15:22Z",
- "declined_by": "string",
- "declined_at": "2019-08-24T14:15:22Z",
- "declined_reason": "string",
- "canceled_by": "string",
- "canceled_at": "2019-08-24T14:15:22Z",
- "subtotal": 8000,
- "discount_total": 800,
- "shipping_total": 800,
- "gift_card_total": 800,
- "gift_card_tax_total": 800,
- "tax_total": 0,
- "total": 8200,
- "difference_due": 8200,
- "status": "confirmed",
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "payment_collection_id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "payment_collection": {
- "id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "type": "order_edit",
- "status": "not_paid",
- "description": "string",
- "amount": 0,
- "authorized_amount": 0,
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "payment_sessions": [
- null
], - "payments": [
- null
], - "created_by": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}Delete line items from an order edit and create change item
| id required | string The ID of the Order Edit to delete from. |
| item_id required | string The ID of the order edit item to delete from order. |
required | object (Order Edit) Order edit keeps track of order items changes. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.orderEdits.removeLineItem(order_edit_id, line_item_id) .then(({ order_edit }) => { console.log(order_edit.id) })
{- "order_edit": {
- "id": "oe_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order_id": "order_01G2SG30J8C85S4A5CHM2S1NS2",
- "order": { },
- "changes": [
- {
- "id": null,
- "type": null,
- "order_edit_id": null,
- "order_edit": { },
- "original_line_item_id": null,
- "original_line_item": null,
- "line_item_id": null,
- "line_item": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "internal_note": "Included two more items B to the order.",
- "created_by": "string",
- "requested_by": "string",
- "requested_at": "2019-08-24T14:15:22Z",
- "confirmed_by": "string",
- "confirmed_at": "2019-08-24T14:15:22Z",
- "declined_by": "string",
- "declined_at": "2019-08-24T14:15:22Z",
- "declined_reason": "string",
- "canceled_by": "string",
- "canceled_at": "2019-08-24T14:15:22Z",
- "subtotal": 8000,
- "discount_total": 800,
- "shipping_total": 800,
- "gift_card_total": 800,
- "gift_card_tax_total": 800,
- "tax_total": 0,
- "total": 8200,
- "difference_due": 8200,
- "status": "confirmed",
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "payment_collection_id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "payment_collection": {
- "id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "type": "order_edit",
- "status": "not_paid",
- "description": "string",
- "amount": 0,
- "authorized_amount": 0,
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "payment_sessions": [
- null
], - "payments": [
- null
], - "created_by": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}Request customer confirmation of an Order Edit
| id required | string The ID of the Order Edit to request confirmation from. |
required | object (Order Edit) Order edit keeps track of order items changes. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.orderEdits.requestConfirmation(order_edit_id) .then({ order_edit }) => { console.log(order_edit.id) })
{- "order_edit": {
- "id": "oe_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order_id": "order_01G2SG30J8C85S4A5CHM2S1NS2",
- "order": { },
- "changes": [
- {
- "id": null,
- "type": null,
- "order_edit_id": null,
- "order_edit": { },
- "original_line_item_id": null,
- "original_line_item": null,
- "line_item_id": null,
- "line_item": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "internal_note": "Included two more items B to the order.",
- "created_by": "string",
- "requested_by": "string",
- "requested_at": "2019-08-24T14:15:22Z",
- "confirmed_by": "string",
- "confirmed_at": "2019-08-24T14:15:22Z",
- "declined_by": "string",
- "declined_at": "2019-08-24T14:15:22Z",
- "declined_reason": "string",
- "canceled_by": "string",
- "canceled_at": "2019-08-24T14:15:22Z",
- "subtotal": 8000,
- "discount_total": 800,
- "shipping_total": 800,
- "gift_card_total": 800,
- "gift_card_tax_total": 800,
- "tax_total": 0,
- "total": 8200,
- "difference_due": 8200,
- "status": "confirmed",
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "payment_collection_id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "payment_collection": {
- "id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "type": "order_edit",
- "status": "not_paid",
- "description": "string",
- "amount": 0,
- "authorized_amount": 0,
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "payment_sessions": [
- null
], - "payments": [
- null
], - "created_by": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}Retrieves a list of Orders
| q | string Query used for searching orders by shipping address first name, orders' email, and orders' display ID |
| id | string ID of the order to search for. |
| status | Array of strings Items Enum: "pending" "completed" "archived" "canceled" "requires_action" Status to search for |
| fulfillment_status | Array of strings Items Enum: "not_fulfilled" "fulfilled" "partially_fulfilled" "shipped" "partially_shipped" "canceled" "returned" "partially_returned" "requires_action" Fulfillment status to search for. |
| payment_status | Array of strings Items Enum: "captured" "awaiting" "not_paid" "refunded" "partially_refunded" "canceled" "requires_action" Payment status to search for. |
| display_id | string Display ID to search for. |
| cart_id | string to search for. |
| customer_id | string to search for. |
string to search for. | |
string or Array of strings Regions to search orders by | |
| currency_code | |
| tax_rate | string to search for. |
object Date comparison for when resulting orders were created. | |
object Date comparison for when resulting orders were updated. | |
object Date comparison for when resulting orders were canceled. | |
| sales_channel_id | Array of strings Filter by Sales Channels |
| offset | integer Default: 0 How many orders to skip before the results. |
| limit | integer Default: 50 Limit the number of orders returned. |
| expand | string (Comma separated) Which fields should be expanded in each order of the result. |
| fields | string (Comma separated) Which fields should be included in each order of the result. |
required | Array of objects (Order) |
| count required | integer The total number of items available |
| offset required | integer The number of items skipped before these items |
| limit required | integer The number of items per page |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.orders.list() .then(({ orders, limit, offset, count }) => { console.log(orders.length); });
{- "orders": [
- {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": null,
- "customer_id": null,
- "customer": { },
- "company": null,
- "first_name": null,
- "last_name": null,
- "address_1": null,
- "address_2": null,
- "city": null,
- "country_code": null,
- "country": null,
- "province": null,
- "postal_code": null,
- "phone": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": null,
- "customer_id": null,
- "customer": { },
- "company": null,
- "first_name": null,
- "last_name": null,
- "address_1": null,
- "address_2": null,
- "city": null,
- "country_code": null,
- "country": null,
- "province": null,
- "postal_code": null,
- "phone": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "discounts": [
- null
], - "gift_cards": [
- null
], - "shipping_methods": [
- null
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- null
], - "edits": [
- { }
], - "gift_card_transactions": [
- null
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": null,
- "name": null,
- "description": null,
- "is_disabled": null,
- "locations": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}Retrieves an Order
| id required | string The ID of the Order. |
| expand | string Comma separated list of relations to include in the results. |
| fields | string Comma separated list of fields to include in the results. |
required | object (Order) Represents an order |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.orders.retrieve(order_id) .then(({ order }) => { console.log(order.id); });
{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Updates and order
| id required | string The ID of the Order. |
| expand | string Comma separated list of relations to include in the result. |
| fields | string Comma separated list of fields to include in the result. |
string the email for the order | |
object (AddressPayload) Address fields used when creating/updating an address. | |
object (AddressPayload) Address fields used when creating/updating an address. | |
Array of objects (Line Item) The Line Items for the order | |
| region | string ID of the region where the order belongs |
Array of objects (Discount) Discounts applied to the order | |
| customer_id | string ID of the customer |
object payment method chosen for the order | |
object The Shipping Method used for shipping the order. | |
| no_notification | boolean A flag to indicate if no notifications should be emitted related to the updated order. |
required | object (Order) Represents an order |
{- "email": "string",
- "billing_address": {
- "first_name": "Arno",
- "last_name": "Willms",
- "phone": 16128234334802,
- "company": "string",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "province": "Kentucky",
- "postal_code": 72093,
- "metadata": {
- "car": "white"
}
}, - "shipping_address": {
- "first_name": "Arno",
- "last_name": "Willms",
- "phone": 16128234334802,
- "company": "string",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "province": "Kentucky",
- "postal_code": 72093,
- "metadata": {
- "car": "white"
}
}, - "items": [
- {
- "id": "item_01G8ZC9GWT6B2GP5FSXRXNFNGN",
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [
- null
], - "adjustments": [
- null
], - "original_item_id": "string",
- "order_edit_id": "string",
- "order_edit": { },
- "title": "Medusa Coffee Mug",
- "description": "One Size",
- "is_return": false,
- "is_giftcard": false,
- "should_merge": true,
- "allow_discounts": true,
- "has_shipping": false,
- "unit_price": 8000,
- "variant_id": "variant_01G1G5V2MRX2V3PVSR2WXYPFB6",
- "variant": {
- "id": null,
- "title": null,
- "product_id": null,
- "product": { },
- "prices": [ ],
- "sku": null,
- "barcode": null,
- "ean": null,
- "upc": null,
- "variant_rank": null,
- "inventory_quantity": null,
- "allow_backorder": null,
- "manage_inventory": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "options": [ ],
- "inventory_items": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { },
- "purchasable": null
}, - "quantity": 1,
- "fulfilled_quantity": 0,
- "returned_quantity": 0,
- "shipped_quantity": 0,
- "refundable": 0,
- "subtotal": 8000,
- "tax_total": 0,
- "total": 8000,
- "original_total": 8000,
- "original_tax_total": 0,
- "discount_total": 0,
- "raw_discount_total": 0,
- "gift_card_total": 0,
- "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "region": "string",
- "discounts": [
- {
- "id": "disc_01F0YESMW10MGHWJKZSDDMN0VN",
- "code": "10DISC",
- "is_dynamic": false,
- "rule_id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "rule": {
- "id": null,
- "type": null,
- "description": null,
- "value": null,
- "allocation": null,
- "conditions": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "is_disabled": false,
- "parent_discount_id": "disc_01G8ZH853YPY9B94857DY91YGW",
- "parent_discount": { },
- "starts_at": "2019-08-24T14:15:22Z",
- "ends_at": "2019-08-24T14:15:22Z",
- "valid_duration": "P3Y6M4DT12H30M5S",
- "regions": [
- null
], - "usage_limit": 100,
- "usage_count": 50,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "customer_id": "string",
- "payment_method": {
- "provider_id": "string",
- "data": { }
}, - "shipping_method": {
- "provider_id": "string",
- "profile_id": "string",
- "price": 0,
- "data": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
]
}, - "no_notification": true
}{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Archives the order with the given id.
| id required | string The ID of the Order. |
| expand | string Comma separated list of relations to include in the result. |
| fields | string Comma separated list of fields to include in the result. |
required | object (Order) Represents an order |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.orders.archive(order_id) .then(({ order }) => { console.log(order.id); });
{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Registers an Order as canceled. This triggers a flow that will cancel any created Fulfillments and Payments, may fail if the Payment or Fulfillment Provider is unable to cancel the Payment/Fulfillment.
| id required | string The ID of the Order. |
| expand | string Comma separated list of relations to include in the result. |
| fields | string Comma separated list of fields to include in the result. |
required | object (Order) Represents an order |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.orders.cancel(order_id) .then(({ order }) => { console.log(order.id); });
{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Captures all the Payments associated with an Order.
| id required | string The ID of the Order. |
| expand | string Comma separated list of relations to include in the result. |
| fields | string Comma separated list of fields to include in the result. |
required | object (Order) Represents an order |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.orders.capturePayment(order_id) .then(({ order }) => { console.log(order.id); });
{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Creates a Claim.
| id required | string The ID of the Order. |
| expand | string Comma separated list of relations to include in the result. |
| fields | string Comma separated list of fields to include in the result. |
| type required | string Enum: "replace" "refund" The type of the Claim. This will determine how the Claim is treated: |
required | Array of objects The Claim Items that the Claim will consist of. |
object Optional details for the Return Shipping Method, if the items are to be sent back. | |
Array of objects The new items to send to the Customer when the Claim type is Replace. | |
Array of objects The Shipping Methods to send the additional Line Items with. | |
object (AddressPayload) Address fields used when creating/updating an address. | |
| refund_amount | integer The amount to refund the Customer when the Claim type is |
| no_notification | boolean If set to true no notification will be send related to this Claim. |
| metadata | object An optional set of key-value pairs to hold additional information. |
required | object (Order) Represents an order |
{- "type": "replace",
- "claim_items": [
- {
- "item_id": "string",
- "quantity": 0,
- "note": "string",
- "reason": "missing_item",
- "tags": [
- null
], - "images": [
- null
]
}
], - "return_shipping": {
- "option_id": "string",
- "price": 0
}, - "additional_items": [
- {
- "variant_id": "string",
- "quantity": 0
}
], - "shipping_methods": [
- {
- "id": "string",
- "option_id": "string",
- "price": 0,
- "data": { }
}
], - "shipping_address": {
- "first_name": "Arno",
- "last_name": "Willms",
- "phone": 16128234334802,
- "company": "string",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "province": "Kentucky",
- "postal_code": 72093,
- "metadata": {
- "car": "white"
}
}, - "refund_amount": 0,
- "no_notification": true,
- "metadata": { }
}{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Updates a Claim.
| id required | string The ID of the Order. |
| claim_id required | string The ID of the Claim. |
| expand | string Comma separated list of relations to include in the result. |
| fields | string Comma separated list of fields to include in the result. |
Array of objects The Claim Items that the Claim will consist of. | |
Array of objects The Shipping Methods to send the additional Line Items with. | |
| no_notification | boolean If set to true no notification will be send related to this Swap. |
| metadata | object An optional set of key-value pairs to hold additional information. |
required | object (Order) Represents an order |
{- "claim_items": [
- {
- "id": "string",
- "item_id": "string",
- "quantity": 0,
- "note": "string",
- "reason": "missing_item",
- "tags": [
- { }
], - "images": [
- { }
], - "metadata": { }
}
], - "shipping_methods": [
- {
- "id": "string",
- "option_id": "string",
- "price": 0,
- "data": { }
}
], - "no_notification": true,
- "metadata": { }
}{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Cancels a Claim
| id required | string The ID of the Order. |
| claim_id required | string The ID of the Claim. |
| expand | string Comma separated list of relations to include in the result. |
| fields | string Comma separated list of fields to include in the result. |
required | object (Order) Represents an order |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.orders.cancelClaim(order_id, claim_id) .then(({ order }) => { console.log(order.id); });
{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Creates a Fulfillment for a Claim.
| id required | string The ID of the Order. |
| claim_id required | string The ID of the Claim. |
| expand | string Comma separated list of relations to include in the result. |
| fields | string Comma separated list of fields to include in the result. |
| metadata | object An optional set of key-value pairs to hold additional information. |
| no_notification | boolean If set to true no notification will be send related to this Claim. |
required | object (Order) Represents an order |
{- "metadata": { },
- "no_notification": true
}{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Registers a claim's fulfillment as canceled.
| id required | string The ID of the Order which the Claim relates to. |
| claim_id required | string The ID of the Claim which the Fulfillment relates to. |
| fulfillment_id required | string The ID of the Fulfillment. |
| expand | string Comma separated list of relations to include in the result. |
| fields | string Comma separated list of fields to include in the result. |
required | object (Order) Represents an order |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.orders.cancelClaimFulfillment(order_id, claim_id, fulfillment_id) .then(({ order }) => { console.log(order.id); });
{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Registers a Claim Fulfillment as shipped.
| id required | string The ID of the Order. |
| claim_id required | string The ID of the Claim. |
| expand | string Comma separated list of relations to include in the result. |
| fields | string Comma separated list of fields to include in the result. |
| fulfillment_id required | string The ID of the Fulfillment. |
| tracking_numbers | Array of strings The tracking numbers for the shipment. |
required | object (Order) Represents an order |
{- "fulfillment_id": "string",
- "tracking_numbers": [
- "string"
]
}{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Completes an Order
| id required | string The ID of the Order. |
| expand | string Comma separated list of relations to include in the result. |
| fields | string Comma separated list of fields to include in the result. |
required | object (Order) Represents an order |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.orders.complete(order_id) .then(({ order }) => { console.log(order.id); });
{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Creates a Fulfillment of an Order - will notify Fulfillment Providers to prepare a shipment.
| id required | string The ID of the Order. |
| expand | string Comma separated list of relations to include in the result. |
| fields | string Comma separated list of fields to include in the result. |
required | Array of objects The Line Items to include in the Fulfillment. |
| no_notification | boolean If set to true no notification will be send related to this Swap. |
| metadata | object An optional set of key-value pairs to hold additional information. |
required | object (Order) Represents an order |
{- "items": [
- {
- "item_id": "string",
- "quantity": 0
}
], - "no_notification": true,
- "metadata": { }
}{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Registers a Fulfillment as canceled.
| id required | string The ID of the Order which the Fulfillment relates to. |
| fulfillment_id required | string The ID of the Fulfillment |
| expand | string Comma separated list of relations to include in the result. |
| fields | string Comma separated list of fields to include in the result. |
required | object (Order) Represents an order |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.orders.cancelFulfillment(order_id, fulfillment_id) .then(({ order }) => { console.log(order.id); });
{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Creates a Reservation for a line item at a specified location, optionally for a partial quantity.
| id required | string The ID of the Order. |
| line_item_id required | string The ID of the Line item. |
| location_id required | string The id of the location of the reservation |
| quantity | number The quantity to reserve |
| location_id required | string The id of the location of the reservation |
| inventory_item_id required | string The id of the inventory item the reservation relates to |
| quantity required | number The id of the reservation item |
| line_item_id | string The id of the location of the reservation |
| metadata | object An optional set of key-value pairs with additional information. |
{- "location_id": "string",
- "quantity": 0
}{- "line_item_id": "string",
- "location_id": "string",
- "inventory_item_id": "string",
- "quantity": 0,
- "metadata": { }
}Issues a Refund.
| id required | string The ID of the Order. |
| expand | string Comma separated list of relations to include in the result. |
| fields | string Comma separated list of fields to include in the result. |
| amount required | integer The amount to refund. |
| reason required | string The reason for the Refund. |
| note | string A note with additional details about the Refund. |
| no_notification | boolean If set to true no notification will be send related to this Refund. |
required | object (Order) Represents an order |
{- "amount": 0,
- "reason": "string",
- "note": "string",
- "no_notification": true
}{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Retrieves reservations of an Order
| id required | string The ID of the Order. |
| offset | integer Default: 0 How many reservations to skip before the results. |
| limit | integer Default: 20 Limit the number of reservations returned. |
required | Array of objects (Reservation item) |
| count required | integer The total number of items available |
| offset required | integer The number of items skipped before these items |
| limit required | integer The number of items per page |
curl --location --request GET 'https://medusa-url.com/admin/orders/{id}/reservations' \ --header 'Authorization: Bearer {api_token}'
{- "reservations": [
- {
- "id": "string",
- "location_id": "string",
- "inventory_item_id": "string",
- "description": "string",
- "created_by": "string",
- "quantity": 0,
- "metadata": {
- "car": "white"
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}Requests a Return. If applicable a return label will be created and other plugins notified.
| id required | string The ID of the Order. |
| expand | string Comma separated list of relations to include in the result. |
| fields | string Comma separated list of fields to include in the result. |
required | Array of objects The Line Items that will be returned. |
object The Shipping Method to be used to handle the return shipment. | |
| note | string An optional note with information about the Return. |
| receive_now | boolean Default: false A flag to indicate if the Return should be registerd as received immediately. |
| no_notification | boolean A flag to indicate if no notifications should be emitted related to the requested Return. |
| refund | integer The amount to refund. |
required | object (Order) Represents an order |
{- "items": [
- {
- "item_id": "string",
- "reason_id": "string",
- "note": "string",
- "quantity": 0
}
], - "return_shipping": {
- "option_id": "string",
- "price": 0
}, - "note": "string",
- "receive_now": false,
- "no_notification": true,
- "refund": 0
}{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Registers a Fulfillment as shipped.
| id required | string The ID of the Order. |
| expand | string Comma separated list of relations to include in the result. |
| fields | string Comma separated list of fields to include in the result. |
| fulfillment_id required | string The ID of the Fulfillment. |
| tracking_numbers | Array of strings The tracking numbers for the shipment. |
| no_notification | boolean If set to true no notification will be send related to this Shipment. |
required | object (Order) Represents an order |
{- "fulfillment_id": "string",
- "tracking_numbers": [
- "string"
], - "no_notification": true
}{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Adds a Shipping Method to an Order. If another Shipping Method exists with the same Shipping Profile, the previous Shipping Method will be replaced.
| id required | string The ID of the Order. |
| expand | string Comma separated list of relations to include in the result. |
| fields | string Comma separated list of fields to include in the result. |
| price required | number The price (excluding VAT) that should be charged for the Shipping Method |
| option_id required | string The ID of the Shipping Option to create the Shipping Method from. |
| date | object The data required for the Shipping Option to create a Shipping Method. This will depend on the Fulfillment Provider. |
required | object (Order) Represents an order |
{- "price": 0,
- "option_id": "string",
- "date": { }
}{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Creates a Swap. Swaps are used to handle Return of previously purchased goods and Fulfillment of replacements simultaneously.
| id required | string The ID of the Order. |
| expand | string (Comma separated) Which fields should be expanded the order of the result. |
| fields | string (Comma separated) Which fields should be included the order of the result. |
required | Array of objects The Line Items to return as part of the Swap. |
object How the Swap will be returned. | |
Array of objects The new items to send to the Customer. | |
Array of objects The custom shipping options to potentially create a Shipping Method from. | |
| no_notification | boolean If set to true no notification will be send related to this Swap. |
| allow_backorder | boolean Default: true If true, swaps can be completed with items out of stock |
required | object (Order) Represents an order |
{- "return_items": [
- {
- "item_id": "string",
- "quantity": 0,
- "reason_id": "string",
- "note": "string"
}
], - "return_shipping": {
- "option_id": "string",
- "price": 0
}, - "additional_items": [
- {
- "variant_id": "string",
- "quantity": 0
}
], - "custom_shipping_options": [
- {
- "option_id": "string",
- "price": 0
}
], - "no_notification": true,
- "allow_backorder": true
}{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Cancels a Swap
| id required | string The ID of the Order. |
| swap_id required | string The ID of the Swap. |
| expand | string Comma separated list of relations to include in the result. |
| fields | string Comma separated list of fields to include in the result. |
required | object (Order) Represents an order |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.orders.cancelSwap(order_id, swap_id) .then(({ order }) => { console.log(order.id); });
{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Creates a Fulfillment for a Swap.
| id required | string The ID of the Order. |
| swap_id required | string The ID of the Swap. |
| expand | string Comma separated list of relations to include in the result. |
| fields | string Comma separated list of fields to include in the result. |
| metadata | object An optional set of key-value pairs to hold additional information. |
| no_notification | boolean If set to true no notification will be send related to this Claim. |
required | object (Order) Represents an order |
{- "metadata": { },
- "no_notification": true
}{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Registers a Swap's Fulfillment as canceled.
| id required | string The ID of the Order which the Swap relates to. |
| swap_id required | string The ID of the Swap which the Fulfillment relates to. |
| fulfillment_id required | string The ID of the Fulfillment. |
| expand | string Comma separated list of relations to include in the result. |
| fields | string Comma separated list of fields to include in the result. |
required | object (Order) Represents an order |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.orders.cancelSwapFulfillment(order_id, swap_id, fulfillment_id) .then(({ order }) => { console.log(order.id); });
{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}When there are differences between the returned and shipped Products in a Swap, the difference must be processed. Either a Refund will be issued or a Payment will be captured.
| id required | string The ID of the Order. |
| swap_id required | string The ID of the Swap. |
| expand | string Comma separated list of relations to include in the result. |
| fields | string Comma separated list of fields to include in the result. |
required | object (Order) Represents an order |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.orders.processSwapPayment(order_id, swap_id) .then(({ order }) => { console.log(order.id); });
{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Registers a Swap Fulfillment as shipped.
| id required | string The ID of the Order. |
| swap_id required | string The ID of the Swap. |
| expand | string Comma separated list of relations to include in the result. |
| fields | string Comma separated list of fields to include in the result. |
| fulfillment_id required | string The ID of the Fulfillment. |
| tracking_numbers | Array of strings The tracking numbers for the shipment. |
| no_notification | boolean If set to true no notification will be sent related to this Claim. |
required | object (Order) Represents an order |
{- "fulfillment_id": "string",
- "tracking_numbers": [
- "string"
], - "no_notification": true
}{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Retrieves a PaymentCollection.
| id required | string The ID of the PaymentCollection. |
| expand | string Comma separated list of relations to include in the results. |
| fields | string Comma separated list of fields to include in the results. |
required | object (Payment Collection) Payment Collection |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.paymentCollections.retrieve(paymentCollectionId) .then(({ payment_collection }) => { console.log(payment_collection.id) })
{- "payment_collection": {
- "id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "type": "order_edit",
- "status": "not_paid",
- "description": "string",
- "amount": 0,
- "authorized_amount": 0,
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "payment_sessions": [
- {
- "id": null,
- "cart_id": null,
- "cart": null,
- "provider_id": null,
- "is_selected": null,
- "is_initiated": null,
- "status": null,
- "data": { },
- "idempotency_key": null,
- "amount": null,
- "payment_authorized_at": null,
- "created_at": null,
- "updated_at": null
}
], - "payments": [
- {
- "id": null,
- "swap_id": null,
- "swap": { },
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "currency_code": null,
- "currency": null,
- "amount_refunded": null,
- "provider_id": null,
- "data": { },
- "captured_at": null,
- "canceled_at": null,
- "idempotency_key": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_by": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Updates a PaymentCollection.
| id required | string The ID of the PaymentCollection. |
| description | string An optional description to create or update the payment collection. |
| metadata | object An optional set of key-value pairs to hold additional information. |
required | object (Payment Collection) Payment Collection |
{- "description": "string",
- "metadata": { }
}{- "payment_collection": {
- "id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "type": "order_edit",
- "status": "not_paid",
- "description": "string",
- "amount": 0,
- "authorized_amount": 0,
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "payment_sessions": [
- {
- "id": null,
- "cart_id": null,
- "cart": null,
- "provider_id": null,
- "is_selected": null,
- "is_initiated": null,
- "status": null,
- "data": { },
- "idempotency_key": null,
- "amount": null,
- "payment_authorized_at": null,
- "created_at": null,
- "updated_at": null
}
], - "payments": [
- {
- "id": null,
- "swap_id": null,
- "swap": { },
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "currency_code": null,
- "currency": null,
- "amount_refunded": null,
- "provider_id": null,
- "data": { },
- "captured_at": null,
- "canceled_at": null,
- "idempotency_key": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_by": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Deletes a Payment Collection
| id required | string The ID of the Payment Collection to delete. |
| id required | string The ID of the deleted Payment Collection. |
| object required | string Default: "payment_collection" The type of the object that was deleted. |
| deleted required | boolean Default: true Whether or not the Payment Collection was deleted. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.paymentCollections.delete(payment_collection_id) .then(({ id, object, deleted }) => { console.log(id) })
{- "id": "string",
- "object": "payment_collection",
- "deleted": true
}Sets the status of PaymentCollection as Authorized.
| id required | string The ID of the PaymentCollection. |
required | object (Payment Collection) Payment Collection |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.paymentCollections.markAsAuthorized(payment_collection_id) .then(({ payment_collection }) => { console.log(payment_collection.id) })
{- "payment_collection": {
- "id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "type": "order_edit",
- "status": "not_paid",
- "description": "string",
- "amount": 0,
- "authorized_amount": 0,
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "payment_sessions": [
- {
- "id": null,
- "cart_id": null,
- "cart": null,
- "provider_id": null,
- "is_selected": null,
- "is_initiated": null,
- "status": null,
- "data": { },
- "idempotency_key": null,
- "amount": null,
- "payment_authorized_at": null,
- "created_at": null,
- "updated_at": null
}
], - "payments": [
- {
- "id": null,
- "swap_id": null,
- "swap": { },
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "currency_code": null,
- "currency": null,
- "amount_refunded": null,
- "provider_id": null,
- "data": { },
- "captured_at": null,
- "canceled_at": null,
- "idempotency_key": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_by": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Retrieves the Payment details
| id required | string The ID of the Payment. |
required | object (Payment) Payments represent an amount authorized with a given payment method, Payments can be captured, canceled or refunded. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.payments.retrieve(payment_id) .then(({ payment }) => { console.log(payment.id); });
{- "payment": {
- "id": "pay_01G2SJNT6DEEWDFNAJ4XWDTHKE",
- "swap_id": null,
- "swap": { },
- "cart_id": "string",
- "cart": { },
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "amount": 100,
- "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "amount_refunded": 0,
- "provider_id": "manual",
- "data": { },
- "captured_at": "2019-08-24T14:15:22Z",
- "canceled_at": "2019-08-24T14:15:22Z",
- "idempotency_key": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Captures a Payment.
| id required | string The ID of the Payment. |
required | object (Payment) Payments represent an amount authorized with a given payment method, Payments can be captured, canceled or refunded. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.payments.capturePayment(payment_id) .then(({ payment }) => { console.log(payment.id); });
{- "payment": {
- "id": "pay_01G2SJNT6DEEWDFNAJ4XWDTHKE",
- "swap_id": null,
- "swap": { },
- "cart_id": "string",
- "cart": { },
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "amount": 100,
- "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "amount_refunded": 0,
- "provider_id": "manual",
- "data": { },
- "captured_at": "2019-08-24T14:15:22Z",
- "canceled_at": "2019-08-24T14:15:22Z",
- "idempotency_key": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Issues a Refund.
| id required | string The ID of the Payment. |
| amount required | integer The amount to refund. |
| reason required | string The reason for the Refund. |
| note | string A note with additional details about the Refund. |
required | object (Refund) Refund represent an amount of money transfered back to the Customer for a given reason. Refunds may occur in relation to Returns, Swaps and Claims, but can also be initiated by a store operator. |
{- "amount": 0,
- "reason": "string",
- "note": "string"
}{- "refund": {
- "id": "ref_01G1G5V27GYX4QXNARRQCW1N8T",
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "payment_id": "pay_01G8ZCC5W42ZNY842124G7P5R9",
- "payment": { },
- "amount": 1000,
- "note": "I didn't like it",
- "reason": "return",
- "idempotency_key": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Retrieves a list of Price Lists.
| limit | number Default: "10" The number of items to get |
| offset | number Default: "0" The offset at which to get items |
| expand | string (Comma separated) Which fields should be expanded in each item of the result. |
| order | string field to order results by. |
| id | string ID to search for. |
| q | string query to search in price list description, price list name, and customer group name fields. |
| status | Array of strings Items Enum: "active" "draft" Status to search for. |
| name | string price list name to search for. |
| customer_groups | Array of strings Customer Group IDs to search for. |
| type | Array of strings Items Enum: "sale" "override" Type to search for. |
object Date comparison for when resulting price lists were created. | |
object Date comparison for when resulting price lists were updated. | |
object Date comparison for when resulting price lists were deleted. |
required | Array of objects (Price List) |
| count required | integer The total number of items available |
| offset required | integer The number of items skipped before these items |
| limit required | integer The number of items per page |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.priceLists.list() .then(({ price_lists, limit, offset, count }) => { console.log(price_lists.length); });
{- "price_lists": [
- {
- "id": "pl_01G8X3CKJXCG5VXVZ87H9KC09W",
- "name": "VIP Prices",
- "description": "Prices for VIP customers",
- "type": "sale",
- "status": "active",
- "starts_at": "2019-08-24T14:15:22Z",
- "ends_at": "2019-08-24T14:15:22Z",
- "customer_groups": [
- null
], - "prices": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}Creates a Price List
| name required | string The name of the Price List |
| description required | string A description of the Price List. |
| type required | string Enum: "sale" "override" The type of the Price List. |
required | Array of objects The prices of the Price List. |
| starts_at | string <date> The date with timezone that the Price List starts being valid. |
| ends_at | string <date> The date with timezone that the Price List ends being valid. |
| status | string Enum: "active" "draft" The status of the Price List. |
Array of objects A list of customer groups that the Price List applies to. | |
| includes_tax | boolean [EXPERIMENTAL] Tax included in prices of price list |
required | object (Price List) Price Lists represents a set of prices that overrides the default price for one or more product variants. |
{- "name": "string",
- "description": "string",
- "starts_at": "2019-08-24",
- "ends_at": "2019-08-24",
- "type": "sale",
- "status": "active",
- "prices": [
- {
- "region_id": "string",
- "currency_code": "string",
- "amount": 0,
- "variant_id": "string",
- "min_quantity": 0,
- "max_quantity": 0
}
], - "customer_groups": [
- {
- "id": "string"
}
], - "includes_tax": true
}{- "price_list": {
- "id": "pl_01G8X3CKJXCG5VXVZ87H9KC09W",
- "name": "VIP Prices",
- "description": "Prices for VIP customers",
- "type": "sale",
- "status": "active",
- "starts_at": "2019-08-24T14:15:22Z",
- "ends_at": "2019-08-24T14:15:22Z",
- "customer_groups": [
- {
- "id": null,
- "name": null,
- "customers": [ ],
- "price_lists": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "prices": [
- {
- "id": null,
- "currency_code": null,
- "currency": null,
- "amount": null,
- "min_quantity": null,
- "max_quantity": null,
- "price_list_id": null,
- "price_list": { },
- "variant_id": null,
- "variant": { },
- "region_id": null,
- "region": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}Retrieves a Price List.
| id required | string The ID of the Price List. |
required | object (Price List) Price Lists represents a set of prices that overrides the default price for one or more product variants. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.priceLists.retrieve(price_list_id) .then(({ price_list }) => { console.log(price_list.id); });
{- "price_list": {
- "id": "pl_01G8X3CKJXCG5VXVZ87H9KC09W",
- "name": "VIP Prices",
- "description": "Prices for VIP customers",
- "type": "sale",
- "status": "active",
- "starts_at": "2019-08-24T14:15:22Z",
- "ends_at": "2019-08-24T14:15:22Z",
- "customer_groups": [
- {
- "id": null,
- "name": null,
- "customers": [ ],
- "price_lists": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "prices": [
- {
- "id": null,
- "currency_code": null,
- "currency": null,
- "amount": null,
- "min_quantity": null,
- "max_quantity": null,
- "price_list_id": null,
- "price_list": { },
- "variant_id": null,
- "variant": { },
- "region_id": null,
- "region": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}Updates a Price List
| id required | string The ID of the Price List. |
| name | string The name of the Price List |
| description | string A description of the Price List. |
| starts_at | string <date> The date with timezone that the Price List starts being valid. |
| ends_at | string <date> The date with timezone that the Price List ends being valid. |
| type | string Enum: "sale" "override" The type of the Price List. |
| status | string Enum: "active" "draft" The status of the Price List. |
Array of objects The prices of the Price List. | |
Array of objects A list of customer groups that the Price List applies to. | |
| includes_tax | boolean [EXPERIMENTAL] Tax included in prices of price list |
required | object (Price List) Price Lists represents a set of prices that overrides the default price for one or more product variants. |
{- "name": "string",
- "description": "string",
- "starts_at": "2019-08-24",
- "ends_at": "2019-08-24",
- "type": "sale",
- "status": "active",
- "prices": [
- {
- "id": "string",
- "region_id": "string",
- "currency_code": "string",
- "variant_id": "string",
- "amount": 0,
- "min_quantity": 0,
- "max_quantity": 0
}
], - "customer_groups": [
- {
- "id": "string"
}
], - "includes_tax": true
}{- "price_list": {
- "id": "pl_01G8X3CKJXCG5VXVZ87H9KC09W",
- "name": "VIP Prices",
- "description": "Prices for VIP customers",
- "type": "sale",
- "status": "active",
- "starts_at": "2019-08-24T14:15:22Z",
- "ends_at": "2019-08-24T14:15:22Z",
- "customer_groups": [
- {
- "id": null,
- "name": null,
- "customers": [ ],
- "price_lists": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "prices": [
- {
- "id": null,
- "currency_code": null,
- "currency": null,
- "amount": null,
- "min_quantity": null,
- "max_quantity": null,
- "price_list_id": null,
- "price_list": { },
- "variant_id": null,
- "variant": { },
- "region_id": null,
- "region": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}Deletes a Price List
| id required | string The ID of the Price List to delete. |
| id required | string The ID of the deleted Price List. |
| object required | string Default: "price-list" The type of the object that was deleted. |
| deleted required | boolean Default: true Whether or not the items were deleted. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.priceLists.delete(price_list_id) .then(({ id, object, deleted }) => { console.log(id); });
{- "id": "string",
- "object": "price-list",
- "deleted": true
}Batch update prices for a Price List
| id required | string The ID of the Price List to update prices for. |
Array of objects The prices to update or add. | |
| override | boolean If true the prices will replace all existing prices associated with the Price List. |
required | object (Price List) Price Lists represents a set of prices that overrides the default price for one or more product variants. |
{- "prices": [
- {
- "id": "string",
- "region_id": "string",
- "currency_code": "string",
- "variant_id": "string",
- "amount": 0,
- "min_quantity": 0,
- "max_quantity": 0
}
], - "override": true
}{- "price_list": {
- "id": "pl_01G8X3CKJXCG5VXVZ87H9KC09W",
- "name": "VIP Prices",
- "description": "Prices for VIP customers",
- "type": "sale",
- "status": "active",
- "starts_at": "2019-08-24T14:15:22Z",
- "ends_at": "2019-08-24T14:15:22Z",
- "customer_groups": [
- {
- "id": null,
- "name": null,
- "customers": [ ],
- "price_lists": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "prices": [
- {
- "id": null,
- "currency_code": null,
- "currency": null,
- "amount": null,
- "min_quantity": null,
- "max_quantity": null,
- "price_list_id": null,
- "price_list": { },
- "variant_id": null,
- "variant": { },
- "region_id": null,
- "region": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}Batch delete prices that belong to a Price List
| id required | string The ID of the Price List that the Money Amounts (Prices) that will be deleted belongs to. |
| price_ids | Array of strings The price id's of the Money Amounts to delete. |
| ids required | Array of strings |
| object required | string Default: "money-amount" The type of the object that was deleted. |
| deleted required | boolean Default: true Whether or not the items were deleted. |
{- "price_ids": [
- "string"
]
}{- "ids": [
- "string"
], - "object": "money-amount",
- "deleted": true
}Retrieves a list of Product that are part of a Price List
| id required | string ID of the price list. |
| q | string Query used for searching product title and description, variant title and sku, and collection title. |
| id | string ID of the product to search for. |
| status | Array of strings Items Enum: "draft" "proposed" "published" "rejected" Product status to search for |
| collection_id | Array of strings Collection IDs to search for |
| tags | Array of strings Tag IDs to search for |
| title | string product title to search for. |
| description | string product description to search for. |
| handle | string product handle to search for. |
| is_giftcard | string Search for giftcards using is_giftcard=true. |
| type | string to search for. |
| order | string field to sort results by. |
object Date comparison for when resulting products were created. | |
object Date comparison for when resulting products were updated. | |
object Date comparison for when resulting products were deleted. | |
| offset | integer Default: 0 How many products to skip in the result. |
| limit | integer Default: 50 Limit the number of products returned. |
| expand | string (Comma separated) Which fields should be expanded in each product of the result. |
| fields | string (Comma separated) Which fields should be included in each product of the result. |
required | Array of objects (Product) |
| count required | integer The total number of items available |
| offset required | integer The number of items skipped before these items |
| limit required | integer The number of items per page |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.priceLists.listProducts(price_list_id) .then(({ products, limit, offset, count }) => { console.log(products.length); });
{- "products": [
- {
- "id": "prod_01G1G5V2MBA328390B5AXJ610F",
- "title": "Medusa Coffee Mug",
- "subtitle": "string",
- "description": "Every programmer's best friend.",
- "handle": "coffee-mug",
- "is_giftcard": false,
- "status": "draft",
- "images": [
- null
], - "options": [
- null
], - "variants": [
- null
], - "categories": [
- null
], - "profile_id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "profile": {
- "id": null,
- "name": null,
- "type": null,
- "products": [ ],
- "shipping_options": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "collection": {
- "id": null,
- "title": null,
- "handle": null,
- "products": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "type_id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "type": {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "tags": [
- null
], - "discountable": true,
- "external_id": null,
- "sales_channels": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}Delete all the prices related to a specific product in a price list
| id required | string The ID of the Price List that the Money Amounts that will be deleted belongs to. |
| product_id required | string The ID of the product from which the money amount will be deleted. |
| ids required | Array of strings The price ids that have been deleted. |
| object required | string Default: "money-amount" The type of the object that was deleted. |
| deleted required | boolean Default: true Whether or not the items were deleted. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.priceLists.deleteProductPrices(price_list_id, product_id) .then(({ ids, object, deleted }) => { console.log(ids.length); });
{- "ids": [
- "string"
], - "object": "money-amount",
- "deleted": true
}Delete all the prices related to a specific variant in a price list
| id required | string The ID of the Price List that the Money Amounts that will be deleted belongs to. |
| variant_id required | string The ID of the variant from which the money amount will be deleted. |
| ids required | Array of strings The price ids that have been deleted. |
| object required | string Default: "money-amount" The type of the object that was deleted. |
| deleted required | boolean Default: true Whether or not the items were deleted. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.priceLists.deleteVariantPrices(price_list_id, variant_id) .then(({ ids, object, deleted }) => { console.log(ids); });
{- "ids": [
- "string"
], - "object": "money-amount",
- "deleted": true
}Retrieve a list of product categories.
| q | string Query used for searching product category names or handles. |
| handle | string Query used for searching product category by handle. |
| is_internal | boolean Search for only internal categories. |
| is_active | boolean Search for only active categories |
| include_descendants_tree | boolean Include all nested descendants of category |
| parent_category_id | string Returns categories scoped by parent |
| offset | integer Default: 0 How many product categories to skip in the result. |
| limit | integer Default: 100 Limit the number of product categories returned. |
| expand | string (Comma separated) Which fields should be expanded in the product category. |
| fields | string (Comma separated) Which fields should be included in the product category. |
required | Array of objects (ProductCategory) |
| count required | integer The total number of items available |
| offset required | integer The number of items skipped before these items |
| limit required | integer The number of items per page |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.productCategories.list() .then(({ product_categories, limit, offset, count }) => { console.log(product_categories.length); });
{- "product_categories": [
- {
- "id": "pcat_01G2SG30J8C85S4A5CHM2S1NS2",
- "name": "Regular Fit",
- "handle": "regular-fit",
- "mpath": "pcat_id1.pcat_id2.pcat_id3",
- "is_internal": false,
- "is_active": false,
- "rank": 0,
- "category_children": [
- { }
], - "parent_category_id": null,
- "parent_category": { },
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}Creates a Product Category.
| expand | string (Comma separated) Which fields should be expanded in the results. |
| fields | string (Comma separated) Which fields should be retrieved in the results. |
| name required | string The name to identify the Product Category by. |
| description | string An optional text field to describe the Product Category by. |
| handle | string An optional handle to be used in slugs, if none is provided we will kebab-case the title. |
| is_internal | boolean A flag to make product category an internal category for admins |
| is_active | boolean A flag to make product category visible/hidden in the store front |
| parent_category_id | string The ID of the parent product category |
required | object (ProductCategory) Represents a product category |
{- "name": "string",
- "description": "string",
- "handle": "string",
- "is_internal": true,
- "is_active": true,
- "parent_category_id": "string"
}{- "product_category": {
- "id": "pcat_01G2SG30J8C85S4A5CHM2S1NS2",
- "name": "Regular Fit",
- "handle": "regular-fit",
- "mpath": "pcat_id1.pcat_id2.pcat_id3",
- "is_internal": false,
- "is_active": false,
- "rank": 0,
- "category_children": [
- { }
], - "parent_category_id": null,
- "parent_category": { },
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}Retrieves a Product Category.
| id required | string The ID of the Product Category |
| expand | string (Comma separated) Which fields should be expanded in the results. |
| fields | string (Comma separated) Which fields should be included in the results. |
required | object (ProductCategory) Represents a product category |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.productCategories.retrieve(productCategoryId) .then(({ product_category }) => { console.log(product_category.id); });
{- "product_category": {
- "id": "pcat_01G2SG30J8C85S4A5CHM2S1NS2",
- "name": "Regular Fit",
- "handle": "regular-fit",
- "mpath": "pcat_id1.pcat_id2.pcat_id3",
- "is_internal": false,
- "is_active": false,
- "rank": 0,
- "category_children": [
- { }
], - "parent_category_id": null,
- "parent_category": { },
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}Updates a Product Category.
| id required | string The ID of the Product Category. |
| expand | string (Comma separated) Which fields should be expanded in each product category. |
| fields | string (Comma separated) Which fields should be retrieved in each product category. |
| name | string The name to identify the Product Category by. |
| description | string An optional text field to describe the Product Category by. |
| handle | string A handle to be used in slugs. |
| is_internal | boolean A flag to make product category an internal category for admins |
| is_active | boolean A flag to make product category visible/hidden in the store front |
| parent_category_id | string The ID of the parent product category |
| rank | number The rank of the category in the tree node (starting from 0) |
required | object (ProductCategory) Represents a product category |
{- "name": "string",
- "description": "string",
- "handle": "string",
- "is_internal": true,
- "is_active": true,
- "parent_category_id": "string",
- "rank": 0
}{- "product_category": {
- "id": "pcat_01G2SG30J8C85S4A5CHM2S1NS2",
- "name": "Regular Fit",
- "handle": "regular-fit",
- "mpath": "pcat_id1.pcat_id2.pcat_id3",
- "is_internal": false,
- "is_active": false,
- "rank": 0,
- "category_children": [
- { }
], - "parent_category_id": null,
- "parent_category": { },
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}Deletes a Product Category.
| id required | string The ID of the Product Category |
| id required | string The ID of the deleted product category |
| object required | string Default: "product-category" The type of the object that was deleted. |
| deleted required | boolean Default: true Whether or not the items were deleted. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.productCategories.delete(productCategoryId) .then(({ id, object, deleted }) => { console.log(id); });
{- "id": "string",
- "object": "product-category",
- "deleted": true
}Assign a batch of products to a product category.
| id required | string The ID of the Product Category. |
| expand | string (Comma separated) Category fields to be expanded in the response. |
| fields | string (Comma separated) Category fields to be retrieved in the response. |
required | Array of objects The IDs of the products to add to the Product Category |
required | object (ProductCategory) Represents a product category |
{- "product_ids": [
- {
- "id": "string"
}
]
}{- "product_category": {
- "id": "pcat_01G2SG30J8C85S4A5CHM2S1NS2",
- "name": "Regular Fit",
- "handle": "regular-fit",
- "mpath": "pcat_id1.pcat_id2.pcat_id3",
- "is_internal": false,
- "is_active": false,
- "rank": 0,
- "category_children": [
- { }
], - "parent_category_id": null,
- "parent_category": { },
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}Remove a list of products from a product category.
| id required | string The ID of the Product Category. |
| expand | string (Comma separated) Category fields to be expanded in the response. |
| fields | string (Comma separated) Category fields to be retrieved in the response. |
required | Array of objects The IDs of the products to delete from the Product Category. |
required | object (ProductCategory) Represents a product category |
{- "product_ids": [
- {
- "id": "string"
}
]
}{- "product_category": {
- "id": "pcat_01G2SG30J8C85S4A5CHM2S1NS2",
- "name": "Regular Fit",
- "handle": "regular-fit",
- "mpath": "pcat_id1.pcat_id2.pcat_id3",
- "is_internal": false,
- "is_active": false,
- "rank": 0,
- "category_children": [
- { }
], - "parent_category_id": null,
- "parent_category": { },
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}Retrieve a list of Product Tags.
| limit | integer Default: 10 The number of tags to return. |
| offset | integer Default: 0 The number of items to skip before the results. |
| order | string The field to sort items by. |
| discount_condition_id | string The discount condition id on which to filter the tags. |
| value | Array of strings The tag values to search for |
| q | string A query string to search values for |
| id | Array of strings The tag IDs to search for |
object Date comparison for when resulting product tags were created. | |
object Date comparison for when resulting product tags were updated. |
required | Array of objects (Product Tag) |
| count required | integer The total number of items available |
| offset required | integer The number of items skipped before these items |
| limit required | integer The number of items per page |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.productTags.list() .then(({ product_tags }) => { console.log(product_tags.length); });
{- "product_tags": [
- {
- "id": "ptag_01G8K2MTMG9168F2B70S1TAVK3",
- "value": "Pants",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}Retrieve a list of Product Types.
| limit | integer Default: 20 The number of types to return. |
| offset | integer Default: 0 The number of items to skip before the results. |
| order | string The field to sort items by. |
| discount_condition_id | string The discount condition id on which to filter the product types. |
| value | Array of strings The type values to search for |
| id | Array of strings The type IDs to search for |
| q | string A query string to search values for |
object Date comparison for when resulting product types were created. | |
object Date comparison for when resulting product types were updated. |
required | Array of objects (Product Type) |
| count required | integer The total number of items available |
| offset required | integer The number of items skipped before these items |
| limit required | integer The number of items per page |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.productTypes.list() .then(({ product_types }) => { console.log(product_types.length); });
{- "product_types": [
- {
- "id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "value": "Clothing",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}Retrieves a list of Product
| q | string Query used for searching product title and description, variant title and sku, and collection title. |
| discount_condition_id | string The discount condition id on which to filter the product. |
string or Array of strings Filter by product IDs. | |
| status | Array of strings Items Enum: "draft" "proposed" "published" "rejected" Status to search for |
| collection_id | Array of strings Collection ids to search for. |
| tags | Array of strings Tag IDs to search for |
| price_list_id | Array of strings Price List IDs to search for |
| sales_channel_id | Array of strings Sales Channel IDs to filter products by |
| type_id | Array of strings Type IDs to filter products by |
| category_id | Array of strings Category IDs to filter products by |
| include_category_children | boolean Include category children when filtering by category_id |
| title | string title to search for. |
| description | string description to search for. |
| handle | string handle to search for. |
| is_giftcard | boolean Search for giftcards using is_giftcard=true. |
object Date comparison for when resulting products were created. | |
object Date comparison for when resulting products were updated. | |
object Date comparison for when resulting products were deleted. | |
| offset | integer Default: 0 How many products to skip in the result. |
| limit | integer Default: 50 Limit the number of products returned. |
| expand | string (Comma separated) Which fields should be expanded in each product of the result. |
| fields | string (Comma separated) Which fields should be included in each product of the result. |
| order | string the field used to order the products. |
required | Array of objects (Priced Product) |
| count required | integer The total number of items available |
| offset required | integer The number of items skipped before these items |
| limit required | integer The number of items per page |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.products.list() .then(({ products, limit, offset, count }) => { console.log(products.length); });
{- "products": [
- {
- "id": "prod_01G1G5V2MBA328390B5AXJ610F",
- "title": "Medusa Coffee Mug",
- "subtitle": "string",
- "description": "Every programmer's best friend.",
- "handle": "coffee-mug",
- "is_giftcard": false,
- "status": "draft",
- "images": [
- null
], - "options": [
- null
], - "variants": [
- null
], - "categories": [
- null
], - "profile_id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "profile": {
- "id": null,
- "name": null,
- "type": null,
- "products": [ ],
- "shipping_options": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "collection": {
- "id": null,
- "title": null,
- "handle": null,
- "products": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "type_id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "type": {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "tags": [
- null
], - "discountable": true,
- "external_id": null,
- "sales_channels": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}Creates a Product
| title required | string The title of the Product |
| subtitle | string The subtitle of the Product |
| description | string A description of the Product. |
| is_giftcard | boolean Default: false A flag to indicate if the Product represents a Gift Card. Purchasing Products with this flag set to |
| discountable | boolean Default: true A flag to indicate if discounts can be applied to the LineItems generated from this Product |
| images | Array of strings Images of the Product. |
| thumbnail | string The thumbnail to use for the Product. |
| handle | string A unique handle to identify the Product by. |
| status | string Default: "draft" Enum: "draft" "proposed" "published" "rejected" The status of the product. |
object The Product Type to associate the Product with. | |
| collection_id | string The ID of the Collection the Product should belong to. |
Array of objects Tags to associate the Product with. | |
Array of objects [EXPERIMENTAL] Sales channels to associate the Product with. | |
Array of objects Categories to add the Product to. | |
Array of objects The Options that the Product should have. These define on which properties the Product's Product Variants will differ. | |
Array of objects A list of Product Variants to create with the Product. | |
| weight | number The weight of the Product. |
| length | number The length of the Product. |
| height | number The height of the Product. |
| width | number The width of the Product. |
| hs_code | string The Harmonized System code for the Product Variant. |
| origin_country | string The country of origin of the Product. |
| mid_code | string The Manufacturer Identification code for the Product. |
| material | string The material composition of the Product. |
| metadata | object An optional set of key-value pairs with additional information. |
required | object (Priced Product) Products are a grouping of Product Variants that have common properties such as images and descriptions. Products can have multiple options which define the properties that Product Variants differ by. |
{- "title": "string",
- "subtitle": "string",
- "description": "string",
- "is_giftcard": false,
- "discountable": true,
- "images": [
- "string"
], - "thumbnail": "string",
- "handle": "string",
- "status": "draft",
- "type": {
- "id": "string",
- "value": "string"
}, - "collection_id": "string",
- "tags": [
- {
- "id": "string",
- "value": "string"
}
], - "sales_channels": [
- {
- "id": "string"
}
], - "categories": [
- {
- "id": "string"
}
], - "options": [
- {
- "title": "string"
}
], - "variants": [
- {
- "title": "string",
- "sku": "string",
- "ean": "string",
- "upc": "string",
- "barcode": "string",
- "hs_code": "string",
- "inventory_quantity": 0,
- "allow_backorder": true,
- "manage_inventory": true,
- "weight": 0,
- "length": 0,
- "height": 0,
- "width": 0,
- "origin_country": "string",
- "mid_code": "string",
- "material": "string",
- "metadata": { },
- "prices": [
- { }
], - "options": [
- { }
]
}
], - "weight": 0,
- "length": 0,
- "height": 0,
- "width": 0,
- "hs_code": "string",
- "origin_country": "string",
- "mid_code": "string",
- "material": "string",
- "metadata": { }
}{- "product": {
- "id": "prod_01G1G5V2MBA328390B5AXJ610F",
- "title": "Medusa Coffee Mug",
- "subtitle": "string",
- "description": "Every programmer's best friend.",
- "handle": "coffee-mug",
- "is_giftcard": false,
- "status": "draft",
- "images": [
- {
- "id": null,
- "url": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "options": [
- {
- "id": null,
- "title": null,
- "values": [ ],
- "product_id": null,
- "product": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "variants": [
- {
- "id": null,
- "title": null,
- "product_id": null,
- "product": { },
- "prices": [ ],
- "sku": null,
- "barcode": null,
- "ean": null,
- "upc": null,
- "variant_rank": null,
- "inventory_quantity": null,
- "allow_backorder": null,
- "manage_inventory": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "options": [ ],
- "inventory_items": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { },
- "purchasable": null,
- "original_price": null,
- "calculated_price": null,
- "original_price_incl_tax": null,
- "calculated_price_incl_tax": null,
- "original_tax": null,
- "calculated_tax": null,
- "tax_rates": [ ]
}
], - "categories": [
- {
- "id": null,
- "name": null,
- "handle": null,
- "mpath": null,
- "is_internal": null,
- "is_active": null,
- "rank": null,
- "category_children": [ ],
- "parent_category_id": null,
- "parent_category": { },
- "products": [ ],
- "created_at": null,
- "updated_at": null
}
], - "profile_id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "profile": {
- "id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "name": "Default Shipping Profile",
- "type": "default",
- "products": [
- { }
], - "shipping_options": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "collection": {
- "id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "title": "Summer Collection",
- "handle": "summer-collection",
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "type_id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "type": {
- "id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "value": "Clothing",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "tags": [
- {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "discountable": true,
- "external_id": null,
- "sales_channels": [
- {
- "id": null,
- "name": null,
- "description": null,
- "is_disabled": null,
- "locations": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Retrieves a list of Product Tags with how many times each is used.
required | Array of objects |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.products.listTags() .then(({ tags }) => { console.log(tags.length); });
{- "tags": [
- {
- "id": "string",
- "usage_count": "string",
- "value": "string"
}
]
}Retrieves a list of Product Types.
required | Array of objects (Product Type) |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.products.listTypes() .then(({ types }) => { console.log(types.length); });
{- "types": [
- {
- "id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "value": "Clothing",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
]
}Retrieves a Product.
| id required | string The ID of the Product. |
required | object (Priced Product) Products are a grouping of Product Variants that have common properties such as images and descriptions. Products can have multiple options which define the properties that Product Variants differ by. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.products.retrieve(product_id) .then(({ product }) => { console.log(product.id); });
{- "product": {
- "id": "prod_01G1G5V2MBA328390B5AXJ610F",
- "title": "Medusa Coffee Mug",
- "subtitle": "string",
- "description": "Every programmer's best friend.",
- "handle": "coffee-mug",
- "is_giftcard": false,
- "status": "draft",
- "images": [
- {
- "id": null,
- "url": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "options": [
- {
- "id": null,
- "title": null,
- "values": [ ],
- "product_id": null,
- "product": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "variants": [
- {
- "id": null,
- "title": null,
- "product_id": null,
- "product": { },
- "prices": [ ],
- "sku": null,
- "barcode": null,
- "ean": null,
- "upc": null,
- "variant_rank": null,
- "inventory_quantity": null,
- "allow_backorder": null,
- "manage_inventory": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "options": [ ],
- "inventory_items": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { },
- "purchasable": null,
- "original_price": null,
- "calculated_price": null,
- "original_price_incl_tax": null,
- "calculated_price_incl_tax": null,
- "original_tax": null,
- "calculated_tax": null,
- "tax_rates": [ ]
}
], - "categories": [
- {
- "id": null,
- "name": null,
- "handle": null,
- "mpath": null,
- "is_internal": null,
- "is_active": null,
- "rank": null,
- "category_children": [ ],
- "parent_category_id": null,
- "parent_category": { },
- "products": [ ],
- "created_at": null,
- "updated_at": null
}
], - "profile_id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "profile": {
- "id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "name": "Default Shipping Profile",
- "type": "default",
- "products": [
- { }
], - "shipping_options": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "collection": {
- "id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "title": "Summer Collection",
- "handle": "summer-collection",
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "type_id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "type": {
- "id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "value": "Clothing",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "tags": [
- {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "discountable": true,
- "external_id": null,
- "sales_channels": [
- {
- "id": null,
- "name": null,
- "description": null,
- "is_disabled": null,
- "locations": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Updates a Product
| id required | string The ID of the Product. |
| title | string The title of the Product |
| subtitle | string The subtitle of the Product |
| description | string A description of the Product. |
| discountable | boolean A flag to indicate if discounts can be applied to the LineItems generated from this Product |
| images | Array of strings Images of the Product. |
| thumbnail | string The thumbnail to use for the Product. |
| handle | string A unique handle to identify the Product by. |
| status | string Enum: "draft" "proposed" "published" "rejected" The status of the product. |
object The Product Type to associate the Product with. | |
| collection_id | string The ID of the Collection the Product should belong to. |
Array of objects Tags to associate the Product with. | |
Array of objects [EXPERIMENTAL] Sales channels to associate the Product with. | |
Array of objects Categories to add the Product to. | |
Array of objects A list of Product Variants to create with the Product. | |
| weight | number The wieght of the Product. |
| length | number The length of the Product. |
| height | number The height of the Product. |
| width | number The width of the Product. |
| origin_country | string The country of origin of the Product. |
| mid_code | string The Manufacturer Identification code for the Product. |
| material | string The material composition of the Product. |
| metadata | object An optional set of key-value pairs with additional information. |
required | object (Priced Product) Products are a grouping of Product Variants that have common properties such as images and descriptions. Products can have multiple options which define the properties that Product Variants differ by. |
{- "title": "string",
- "subtitle": "string",
- "description": "string",
- "discountable": true,
- "images": [
- "string"
], - "thumbnail": "string",
- "handle": "string",
- "status": "draft",
- "type": {
- "id": "string",
- "value": "string"
}, - "collection_id": "string",
- "tags": [
- {
- "id": "string",
- "value": "string"
}
], - "sales_channels": [
- {
- "id": "string"
}
], - "categories": [
- {
- "id": "string"
}
], - "variants": [
- {
- "id": "string",
- "title": "string",
- "sku": "string",
- "ean": "string",
- "upc": "string",
- "barcode": "string",
- "hs_code": "string",
- "inventory_quantity": 0,
- "allow_backorder": true,
- "manage_inventory": true,
- "weight": 0,
- "length": 0,
- "height": 0,
- "width": 0,
- "origin_country": "string",
- "mid_code": "string",
- "material": "string",
- "metadata": { },
- "prices": [
- { }
], - "options": [
- { }
]
}
], - "weight": 0,
- "length": 0,
- "height": 0,
- "width": 0,
- "origin_country": "string",
- "mid_code": "string",
- "material": "string",
- "metadata": { }
}{- "product": {
- "id": "prod_01G1G5V2MBA328390B5AXJ610F",
- "title": "Medusa Coffee Mug",
- "subtitle": "string",
- "description": "Every programmer's best friend.",
- "handle": "coffee-mug",
- "is_giftcard": false,
- "status": "draft",
- "images": [
- {
- "id": null,
- "url": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "options": [
- {
- "id": null,
- "title": null,
- "values": [ ],
- "product_id": null,
- "product": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "variants": [
- {
- "id": null,
- "title": null,
- "product_id": null,
- "product": { },
- "prices": [ ],
- "sku": null,
- "barcode": null,
- "ean": null,
- "upc": null,
- "variant_rank": null,
- "inventory_quantity": null,
- "allow_backorder": null,
- "manage_inventory": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "options": [ ],
- "inventory_items": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { },
- "purchasable": null,
- "original_price": null,
- "calculated_price": null,
- "original_price_incl_tax": null,
- "calculated_price_incl_tax": null,
- "original_tax": null,
- "calculated_tax": null,
- "tax_rates": [ ]
}
], - "categories": [
- {
- "id": null,
- "name": null,
- "handle": null,
- "mpath": null,
- "is_internal": null,
- "is_active": null,
- "rank": null,
- "category_children": [ ],
- "parent_category_id": null,
- "parent_category": { },
- "products": [ ],
- "created_at": null,
- "updated_at": null
}
], - "profile_id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "profile": {
- "id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "name": "Default Shipping Profile",
- "type": "default",
- "products": [
- { }
], - "shipping_options": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "collection": {
- "id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "title": "Summer Collection",
- "handle": "summer-collection",
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "type_id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "type": {
- "id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "value": "Clothing",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "tags": [
- {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "discountable": true,
- "external_id": null,
- "sales_channels": [
- {
- "id": null,
- "name": null,
- "description": null,
- "is_disabled": null,
- "locations": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Deletes a Product and it's associated Product Variants.
| id required | string The ID of the Product. |
| id required | string The ID of the deleted Product. |
| object required | string Default: "product" The type of the object that was deleted. |
| deleted required | boolean Default: true Whether or not the items were deleted. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.products.delete(product_id) .then(({ id, object, deleted }) => { console.log(id); });
{- "id": "string",
- "object": "product",
- "deleted": true
}Set metadata key/value pair for Product
| id required | string The ID of the Product. |
| key required | string The metadata key |
| value required | string The metadata value |
required | object (Priced Product) Products are a grouping of Product Variants that have common properties such as images and descriptions. Products can have multiple options which define the properties that Product Variants differ by. |
{- "key": "string",
- "value": "string"
}{- "product": {
- "id": "prod_01G1G5V2MBA328390B5AXJ610F",
- "title": "Medusa Coffee Mug",
- "subtitle": "string",
- "description": "Every programmer's best friend.",
- "handle": "coffee-mug",
- "is_giftcard": false,
- "status": "draft",
- "images": [
- {
- "id": null,
- "url": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "options": [
- {
- "id": null,
- "title": null,
- "values": [ ],
- "product_id": null,
- "product": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "variants": [
- {
- "id": null,
- "title": null,
- "product_id": null,
- "product": { },
- "prices": [ ],
- "sku": null,
- "barcode": null,
- "ean": null,
- "upc": null,
- "variant_rank": null,
- "inventory_quantity": null,
- "allow_backorder": null,
- "manage_inventory": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "options": [ ],
- "inventory_items": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { },
- "purchasable": null,
- "original_price": null,
- "calculated_price": null,
- "original_price_incl_tax": null,
- "calculated_price_incl_tax": null,
- "original_tax": null,
- "calculated_tax": null,
- "tax_rates": [ ]
}
], - "categories": [
- {
- "id": null,
- "name": null,
- "handle": null,
- "mpath": null,
- "is_internal": null,
- "is_active": null,
- "rank": null,
- "category_children": [ ],
- "parent_category_id": null,
- "parent_category": { },
- "products": [ ],
- "created_at": null,
- "updated_at": null
}
], - "profile_id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "profile": {
- "id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "name": "Default Shipping Profile",
- "type": "default",
- "products": [
- { }
], - "shipping_options": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "collection": {
- "id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "title": "Summer Collection",
- "handle": "summer-collection",
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "type_id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "type": {
- "id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "value": "Clothing",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "tags": [
- {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "discountable": true,
- "external_id": null,
- "sales_channels": [
- {
- "id": null,
- "name": null,
- "description": null,
- "is_disabled": null,
- "locations": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Adds a Product Option to a Product
| id required | string The ID of the Product. |
| title required | string The title the Product Option will be identified by i.e. "Size" |
required | object (Priced Product) Products are a grouping of Product Variants that have common properties such as images and descriptions. Products can have multiple options which define the properties that Product Variants differ by. |
{- "title": "string"
}{- "product": {
- "id": "prod_01G1G5V2MBA328390B5AXJ610F",
- "title": "Medusa Coffee Mug",
- "subtitle": "string",
- "description": "Every programmer's best friend.",
- "handle": "coffee-mug",
- "is_giftcard": false,
- "status": "draft",
- "images": [
- {
- "id": null,
- "url": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "options": [
- {
- "id": null,
- "title": null,
- "values": [ ],
- "product_id": null,
- "product": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "variants": [
- {
- "id": null,
- "title": null,
- "product_id": null,
- "product": { },
- "prices": [ ],
- "sku": null,
- "barcode": null,
- "ean": null,
- "upc": null,
- "variant_rank": null,
- "inventory_quantity": null,
- "allow_backorder": null,
- "manage_inventory": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "options": [ ],
- "inventory_items": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { },
- "purchasable": null,
- "original_price": null,
- "calculated_price": null,
- "original_price_incl_tax": null,
- "calculated_price_incl_tax": null,
- "original_tax": null,
- "calculated_tax": null,
- "tax_rates": [ ]
}
], - "categories": [
- {
- "id": null,
- "name": null,
- "handle": null,
- "mpath": null,
- "is_internal": null,
- "is_active": null,
- "rank": null,
- "category_children": [ ],
- "parent_category_id": null,
- "parent_category": { },
- "products": [ ],
- "created_at": null,
- "updated_at": null
}
], - "profile_id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "profile": {
- "id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "name": "Default Shipping Profile",
- "type": "default",
- "products": [
- { }
], - "shipping_options": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "collection": {
- "id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "title": "Summer Collection",
- "handle": "summer-collection",
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "type_id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "type": {
- "id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "value": "Clothing",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "tags": [
- {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "discountable": true,
- "external_id": null,
- "sales_channels": [
- {
- "id": null,
- "name": null,
- "description": null,
- "is_disabled": null,
- "locations": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Updates a Product Option
| id required | string The ID of the Product. |
| option_id required | string The ID of the Product Option. |
| title required | string The title of the Product Option |
required | object (Priced Product) Products are a grouping of Product Variants that have common properties such as images and descriptions. Products can have multiple options which define the properties that Product Variants differ by. |
{- "title": "string"
}{- "product": {
- "id": "prod_01G1G5V2MBA328390B5AXJ610F",
- "title": "Medusa Coffee Mug",
- "subtitle": "string",
- "description": "Every programmer's best friend.",
- "handle": "coffee-mug",
- "is_giftcard": false,
- "status": "draft",
- "images": [
- {
- "id": null,
- "url": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "options": [
- {
- "id": null,
- "title": null,
- "values": [ ],
- "product_id": null,
- "product": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "variants": [
- {
- "id": null,
- "title": null,
- "product_id": null,
- "product": { },
- "prices": [ ],
- "sku": null,
- "barcode": null,
- "ean": null,
- "upc": null,
- "variant_rank": null,
- "inventory_quantity": null,
- "allow_backorder": null,
- "manage_inventory": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "options": [ ],
- "inventory_items": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { },
- "purchasable": null,
- "original_price": null,
- "calculated_price": null,
- "original_price_incl_tax": null,
- "calculated_price_incl_tax": null,
- "original_tax": null,
- "calculated_tax": null,
- "tax_rates": [ ]
}
], - "categories": [
- {
- "id": null,
- "name": null,
- "handle": null,
- "mpath": null,
- "is_internal": null,
- "is_active": null,
- "rank": null,
- "category_children": [ ],
- "parent_category_id": null,
- "parent_category": { },
- "products": [ ],
- "created_at": null,
- "updated_at": null
}
], - "profile_id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "profile": {
- "id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "name": "Default Shipping Profile",
- "type": "default",
- "products": [
- { }
], - "shipping_options": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "collection": {
- "id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "title": "Summer Collection",
- "handle": "summer-collection",
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "type_id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "type": {
- "id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "value": "Clothing",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "tags": [
- {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "discountable": true,
- "external_id": null,
- "sales_channels": [
- {
- "id": null,
- "name": null,
- "description": null,
- "is_disabled": null,
- "locations": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Deletes a Product Option. Before a Product Option can be deleted all Option Values for the Product Option must be the same. You may, for example, have to delete some of your variants prior to deleting the Product Option
| id required | string The ID of the Product. |
| option_id required | string The ID of the Product Option. |
| option_id required | string The ID of the deleted Product Option |
| object required | string Default: "option" The type of the object that was deleted. |
| deleted required | boolean Default: true Whether or not the items were deleted. |
required | object (Priced Product) Products are a grouping of Product Variants that have common properties such as images and descriptions. Products can have multiple options which define the properties that Product Variants differ by. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.products.deleteOption(product_id, option_id) .then(({ option_id, object, deleted, product }) => { console.log(product.id); });
{- "option_id": "string",
- "object": "option",
- "deleted": true,
- "product": {
- "id": "prod_01G1G5V2MBA328390B5AXJ610F",
- "title": "Medusa Coffee Mug",
- "subtitle": "string",
- "description": "Every programmer's best friend.",
- "handle": "coffee-mug",
- "is_giftcard": false,
- "status": "draft",
- "images": [
- {
- "id": null,
- "url": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "options": [
- {
- "id": null,
- "title": null,
- "values": [ ],
- "product_id": null,
- "product": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "variants": [
- {
- "id": null,
- "title": null,
- "product_id": null,
- "product": { },
- "prices": [ ],
- "sku": null,
- "barcode": null,
- "ean": null,
- "upc": null,
- "variant_rank": null,
- "inventory_quantity": null,
- "allow_backorder": null,
- "manage_inventory": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "options": [ ],
- "inventory_items": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { },
- "purchasable": null,
- "original_price": null,
- "calculated_price": null,
- "original_price_incl_tax": null,
- "calculated_price_incl_tax": null,
- "original_tax": null,
- "calculated_tax": null,
- "tax_rates": [ ]
}
], - "categories": [
- {
- "id": null,
- "name": null,
- "handle": null,
- "mpath": null,
- "is_internal": null,
- "is_active": null,
- "rank": null,
- "category_children": [ ],
- "parent_category_id": null,
- "parent_category": { },
- "products": [ ],
- "created_at": null,
- "updated_at": null
}
], - "profile_id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "profile": {
- "id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "name": "Default Shipping Profile",
- "type": "default",
- "products": [
- { }
], - "shipping_options": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "collection": {
- "id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "title": "Summer Collection",
- "handle": "summer-collection",
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "type_id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "type": {
- "id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "value": "Clothing",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "tags": [
- {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "discountable": true,
- "external_id": null,
- "sales_channels": [
- {
- "id": null,
- "name": null,
- "description": null,
- "is_disabled": null,
- "locations": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Retrieves a list of the Product Variants associated with a Product.
| id required | string ID of the product to search for the variants. |
| fields | string Comma separated string of the column to select. |
| expand | string Comma separated string of the relations to include. |
| offset | integer Default: 0 How many items to skip before the results. |
| limit | integer Default: 100 Limit the number of items returned. |
required | Array of objects (Product Variant) |
| count required | integer The total number of items available |
| offset required | integer The number of items skipped before these items |
| limit required | integer The number of items per page |
curl --location --request GET 'https://medusa-url.com/admin/products/{id}/variants' \ --header 'Authorization: Bearer {api_token}'
{- "variants": [
- {
- "id": "variant_01G1G5V2MRX2V3PVSR2WXYPFB6",
- "title": "Small",
- "product_id": "prod_01G1G5V2MBA328390B5AXJ610F",
- "product": { },
- "prices": [
- null
], - "sku": "shirt-123",
- "barcode": null,
- "ean": null,
- "upc": null,
- "variant_rank": 0,
- "inventory_quantity": 100,
- "allow_backorder": false,
- "manage_inventory": true,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "options": [
- null
], - "inventory_items": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}, - "purchasable": true
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}Creates a Product Variant. Each Product Variant must have a unique combination of Product Option Values.
| id required | string The ID of the Product. |
| title required | string The title to identify the Product Variant by. |
required | Array of objects |
required | Array of objects |
| sku | string The unique SKU for the Product Variant. |
| ean | string The EAN number of the item. |
| upc | string The UPC number of the item. |
| barcode | string A generic GTIN field for the Product Variant. |
| hs_code | string The Harmonized System code for the Product Variant. |
| inventory_quantity | integer Default: 0 The amount of stock kept for the Product Variant. |
| allow_backorder | boolean Whether the Product Variant can be purchased when out of stock. |
| manage_inventory | boolean Default: true Whether Medusa should keep track of the inventory for this Product Variant. |
| weight | number The wieght of the Product Variant. |
| length | number The length of the Product Variant. |
| height | number The height of the Product Variant. |
| width | number The width of the Product Variant. |
| origin_country | string The country of origin of the Product Variant. |
| mid_code | string The Manufacturer Identification code for the Product Variant. |
| material | string The material composition of the Product Variant. |
| metadata | object An optional set of key-value pairs with additional information. |
required | object (Priced Product) Products are a grouping of Product Variants that have common properties such as images and descriptions. Products can have multiple options which define the properties that Product Variants differ by. |
{- "title": "string",
- "sku": "string",
- "ean": "string",
- "upc": "string",
- "barcode": "string",
- "hs_code": "string",
- "inventory_quantity": 0,
- "allow_backorder": true,
- "manage_inventory": true,
- "weight": 0,
- "length": 0,
- "height": 0,
- "width": 0,
- "origin_country": "string",
- "mid_code": "string",
- "material": "string",
- "metadata": { },
- "prices": [
- {
- "id": "string",
- "region_id": "string",
- "currency_code": "string",
- "amount": 0,
- "min_quantity": 0,
- "max_quantity": 0
}
], - "options": [
- {
- "option_id": "string",
- "value": "string"
}
]
}{- "product": {
- "id": "prod_01G1G5V2MBA328390B5AXJ610F",
- "title": "Medusa Coffee Mug",
- "subtitle": "string",
- "description": "Every programmer's best friend.",
- "handle": "coffee-mug",
- "is_giftcard": false,
- "status": "draft",
- "images": [
- {
- "id": null,
- "url": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "options": [
- {
- "id": null,
- "title": null,
- "values": [ ],
- "product_id": null,
- "product": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "variants": [
- {
- "id": null,
- "title": null,
- "product_id": null,
- "product": { },
- "prices": [ ],
- "sku": null,
- "barcode": null,
- "ean": null,
- "upc": null,
- "variant_rank": null,
- "inventory_quantity": null,
- "allow_backorder": null,
- "manage_inventory": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "options": [ ],
- "inventory_items": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { },
- "purchasable": null,
- "original_price": null,
- "calculated_price": null,
- "original_price_incl_tax": null,
- "calculated_price_incl_tax": null,
- "original_tax": null,
- "calculated_tax": null,
- "tax_rates": [ ]
}
], - "categories": [
- {
- "id": null,
- "name": null,
- "handle": null,
- "mpath": null,
- "is_internal": null,
- "is_active": null,
- "rank": null,
- "category_children": [ ],
- "parent_category_id": null,
- "parent_category": { },
- "products": [ ],
- "created_at": null,
- "updated_at": null
}
], - "profile_id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "profile": {
- "id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "name": "Default Shipping Profile",
- "type": "default",
- "products": [
- { }
], - "shipping_options": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "collection": {
- "id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "title": "Summer Collection",
- "handle": "summer-collection",
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "type_id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "type": {
- "id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "value": "Clothing",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "tags": [
- {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "discountable": true,
- "external_id": null,
- "sales_channels": [
- {
- "id": null,
- "name": null,
- "description": null,
- "is_disabled": null,
- "locations": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Update a Product Variant.
| id required | string The ID of the Product. |
| variant_id required | string The ID of the Product Variant. |
| title | string The title to identify the Product Variant by. |
| sku | string The unique SKU for the Product Variant. |
| ean | string The EAN number of the item. |
| upc | string The UPC number of the item. |
| barcode | string A generic GTIN field for the Product Variant. |
| hs_code | string The Harmonized System code for the Product Variant. |
| inventory_quantity | integer The amount of stock kept for the Product Variant. |
| allow_backorder | boolean Whether the Product Variant can be purchased when out of stock. |
| manage_inventory | boolean Whether Medusa should keep track of the inventory for this Product Variant. |
| weight | number The weight of the Product Variant. |
| length | number The length of the Product Variant. |
| height | number The height of the Product Variant. |
| width | number The width of the Product Variant. |
| origin_country | string The country of origin of the Product Variant. |
| mid_code | string The Manufacturer Identification code for the Product Variant. |
| material | string The material composition of the Product Variant. |
| metadata | object An optional set of key-value pairs with additional information. |
Array of objects | |
Array of objects |
required | object (Priced Product) Products are a grouping of Product Variants that have common properties such as images and descriptions. Products can have multiple options which define the properties that Product Variants differ by. |
{- "title": "string",
- "sku": "string",
- "ean": "string",
- "upc": "string",
- "barcode": "string",
- "hs_code": "string",
- "inventory_quantity": 0,
- "allow_backorder": true,
- "manage_inventory": true,
- "weight": 0,
- "length": 0,
- "height": 0,
- "width": 0,
- "origin_country": "string",
- "mid_code": "string",
- "material": "string",
- "metadata": { },
- "prices": [
- {
- "id": "string",
- "region_id": "string",
- "currency_code": "string",
- "amount": 0,
- "min_quantity": 0,
- "max_quantity": 0
}
], - "options": [
- {
- "option_id": "string",
- "value": "string"
}
]
}{- "product": {
- "id": "prod_01G1G5V2MBA328390B5AXJ610F",
- "title": "Medusa Coffee Mug",
- "subtitle": "string",
- "description": "Every programmer's best friend.",
- "handle": "coffee-mug",
- "is_giftcard": false,
- "status": "draft",
- "images": [
- {
- "id": null,
- "url": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "options": [
- {
- "id": null,
- "title": null,
- "values": [ ],
- "product_id": null,
- "product": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "variants": [
- {
- "id": null,
- "title": null,
- "product_id": null,
- "product": { },
- "prices": [ ],
- "sku": null,
- "barcode": null,
- "ean": null,
- "upc": null,
- "variant_rank": null,
- "inventory_quantity": null,
- "allow_backorder": null,
- "manage_inventory": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "options": [ ],
- "inventory_items": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { },
- "purchasable": null,
- "original_price": null,
- "calculated_price": null,
- "original_price_incl_tax": null,
- "calculated_price_incl_tax": null,
- "original_tax": null,
- "calculated_tax": null,
- "tax_rates": [ ]
}
], - "categories": [
- {
- "id": null,
- "name": null,
- "handle": null,
- "mpath": null,
- "is_internal": null,
- "is_active": null,
- "rank": null,
- "category_children": [ ],
- "parent_category_id": null,
- "parent_category": { },
- "products": [ ],
- "created_at": null,
- "updated_at": null
}
], - "profile_id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "profile": {
- "id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "name": "Default Shipping Profile",
- "type": "default",
- "products": [
- { }
], - "shipping_options": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "collection": {
- "id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "title": "Summer Collection",
- "handle": "summer-collection",
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "type_id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "type": {
- "id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "value": "Clothing",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "tags": [
- {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "discountable": true,
- "external_id": null,
- "sales_channels": [
- {
- "id": null,
- "name": null,
- "description": null,
- "is_disabled": null,
- "locations": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Deletes a Product Variant.
| id required | string The ID of the Product. |
| variant_id required | string The ID of the Product Variant. |
| variant_id required | string The ID of the deleted Product Variant. |
| object required | string Default: "product-variant" The type of the object that was deleted. |
| deleted required | boolean Default: true Whether or not the items were deleted. |
required | object (Priced Product) Products are a grouping of Product Variants that have common properties such as images and descriptions. Products can have multiple options which define the properties that Product Variants differ by. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.products.deleteVariant(product_id, variant_id) .then(({ variant_id, object, deleted, product }) => { console.log(product.id); });
{- "variant_id": "string",
- "object": "product-variant",
- "deleted": true,
- "product": {
- "id": "prod_01G1G5V2MBA328390B5AXJ610F",
- "title": "Medusa Coffee Mug",
- "subtitle": "string",
- "description": "Every programmer's best friend.",
- "handle": "coffee-mug",
- "is_giftcard": false,
- "status": "draft",
- "images": [
- {
- "id": null,
- "url": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "options": [
- {
- "id": null,
- "title": null,
- "values": [ ],
- "product_id": null,
- "product": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "variants": [
- {
- "id": null,
- "title": null,
- "product_id": null,
- "product": { },
- "prices": [ ],
- "sku": null,
- "barcode": null,
- "ean": null,
- "upc": null,
- "variant_rank": null,
- "inventory_quantity": null,
- "allow_backorder": null,
- "manage_inventory": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "options": [ ],
- "inventory_items": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { },
- "purchasable": null,
- "original_price": null,
- "calculated_price": null,
- "original_price_incl_tax": null,
- "calculated_price_incl_tax": null,
- "original_tax": null,
- "calculated_tax": null,
- "tax_rates": [ ]
}
], - "categories": [
- {
- "id": null,
- "name": null,
- "handle": null,
- "mpath": null,
- "is_internal": null,
- "is_active": null,
- "rank": null,
- "category_children": [ ],
- "parent_category_id": null,
- "parent_category": { },
- "products": [ ],
- "created_at": null,
- "updated_at": null
}
], - "profile_id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "profile": {
- "id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "name": "Default Shipping Profile",
- "type": "default",
- "products": [
- { }
], - "shipping_options": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "collection": {
- "id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "title": "Summer Collection",
- "handle": "summer-collection",
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "type_id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "type": {
- "id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "value": "Clothing",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "tags": [
- {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "discountable": true,
- "external_id": null,
- "sales_channels": [
- {
- "id": null,
- "name": null,
- "description": null,
- "is_disabled": null,
- "locations": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Retrieves a Product variant.
| id required | string The ID of the variant. |
| expand | string (Comma separated) Which fields should be expanded the order of the result. |
| fields | string (Comma separated) Which fields should be included the order of the result. |
required | object (Priced Product Variant) Product Variants represent a Product with a specific set of Product Option configurations. The maximum number of Product Variants that a Product can have is given by the number of available Product Option combinations. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.variants.retrieve(product_id) .then(({ product }) => { console.log(product.id); });
{- "variant": {
- "id": "variant_01G1G5V2MRX2V3PVSR2WXYPFB6",
- "title": "Small",
- "product_id": "prod_01G1G5V2MBA328390B5AXJ610F",
- "product": { },
- "prices": [
- {
- "id": null,
- "currency_code": null,
- "currency": null,
- "amount": null,
- "min_quantity": null,
- "max_quantity": null,
- "price_list_id": null,
- "price_list": { },
- "variant_id": null,
- "variant": { },
- "region_id": null,
- "region": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "sku": "shirt-123",
- "barcode": null,
- "ean": null,
- "upc": null,
- "variant_rank": 0,
- "inventory_quantity": 100,
- "allow_backorder": false,
- "manage_inventory": true,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "options": [
- {
- "id": null,
- "value": null,
- "option_id": null,
- "option": { },
- "variant_id": null,
- "variant": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "inventory_items": [
- {
- "id": null,
- "inventory_item_id": null,
- "variant_id": null,
- "variant": { },
- "required_quantity": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}, - "purchasable": true,
- "original_price": 0,
- "calculated_price": 0,
- "original_price_incl_tax": 0,
- "calculated_price_incl_tax": 0,
- "original_tax": 0,
- "calculated_tax": 0,
- "tax_rates": [
- {
- "rate": null,
- "name": null,
- "code": null
}
]
}
}Updates a PublishableApiKey.
| id required | string The ID of the PublishableApiKey. |
| title | string A title to update for the key. |
required | object (Publishable API key) Publishable API key defines scopes (i.e. resources) that are available within a request. |
{- "title": "string"
}{- "publishable_api_key": {
- "id": "pk_01G1G5V27GYX4QXNARRQCW1N8T",
- "created_by": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "revoked_by": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "revoked_at": "2019-08-24T14:15:22Z",
- "title": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}List PublishableApiKeys.
| q | string Query used for searching publishable api keys by title. |
| limit | number Default: "20" The number of items in the response |
| offset | number Default: "0" The offset of items in response |
| expand | string Comma separated list of relations to include in the results. |
| fields | string Comma separated list of fields to include in the results. |
required | Array of objects (Publishable API key) |
| count required | integer The total number of items available |
| offset required | integer The number of items skipped before these items |
| limit required | integer The number of items per page |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.publishableApiKeys.list() .then(({ publishable_api_keys, count, limit, offset }) => { console.log(publishable_api_keys) })
{- "publishable_api_keys": [
- {
- "id": "pk_01G1G5V27GYX4QXNARRQCW1N8T",
- "created_by": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "revoked_by": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "revoked_at": "2019-08-24T14:15:22Z",
- "title": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}Creates a PublishableApiKey.
| title required | string A title for the publishable api key |
required | object (Publishable API key) Publishable API key defines scopes (i.e. resources) that are available within a request. |
{- "title": "string"
}{- "publishable_api_key": {
- "id": "pk_01G1G5V27GYX4QXNARRQCW1N8T",
- "created_by": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "revoked_by": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "revoked_at": "2019-08-24T14:15:22Z",
- "title": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}Retrieve the Publishable Api Key.
| id required | string The ID of the PublishableApiKey. |
required | object (Publishable API key) Publishable API key defines scopes (i.e. resources) that are available within a request. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.publishableApiKeys.retrieve(publishableApiKeyId) .then(({ publishable_api_key }) => { console.log(publishable_api_key.id) })
{- "publishable_api_key": {
- "id": "pk_01G1G5V27GYX4QXNARRQCW1N8T",
- "created_by": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "revoked_by": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "revoked_at": "2019-08-24T14:15:22Z",
- "title": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}Deletes a PublishableApiKeys
| id required | string The ID of the PublishableApiKeys to delete. |
| id required | string The ID of the deleted PublishableApiKey. |
| object required | string Default: "publishable_api_key" The type of the object that was deleted. |
| deleted required | boolean Default: true Whether the PublishableApiKeys was deleted. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.publishableApiKeys.delete(publishableApiKeyId) .then(({ id, object, deleted }) => { console.log(id) })
{- "id": "string",
- "object": "publishable_api_key",
- "deleted": true
}Revokes a PublishableApiKey.
| id required | string The ID of the PublishableApiKey. |
required | object (Publishable API key) Publishable API key defines scopes (i.e. resources) that are available within a request. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.publishableApiKeys.revoke(publishableApiKeyId) .then(({ publishable_api_key }) => { console.log(publishable_api_key.id) })
{- "publishable_api_key": {
- "id": "pk_01G1G5V27GYX4QXNARRQCW1N8T",
- "created_by": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "revoked_by": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "revoked_at": "2019-08-24T14:15:22Z",
- "title": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}List PublishableApiKey's SalesChannels
| id required | string The ID of the Publishable Api Key. |
| q | string Query used for searching sales channels' names and descriptions. |
required | Array of objects (Sales Channel) |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.publishableApiKeys.listSalesChannels() .then(({ sales_channels }) => { console.log(sales_channels.length) })
{- "sales_channels": [
- {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
]
}Assign a batch of sales channels to a publishable api key.
| id required | string The ID of the Publishable Api Key. |
required | Array of objects The IDs of the sales channels to add to the publishable api key |
required | object (Publishable API key) Publishable API key defines scopes (i.e. resources) that are available within a request. |
{- "sales_channel_ids": [
- {
- "id": "string"
}
]
}{- "publishable_api_key": {
- "id": "pk_01G1G5V27GYX4QXNARRQCW1N8T",
- "created_by": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "revoked_by": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "revoked_at": "2019-08-24T14:15:22Z",
- "title": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}Remove a batch of sales channels from a publishable api key.
| id required | string The ID of the Publishable Api Key. |
required | Array of objects The IDs of the sales channels to delete from the publishable api key |
required | object (Publishable API key) Publishable API key defines scopes (i.e. resources) that are available within a request. |
{- "sales_channel_ids": [
- {
- "id": "string"
}
]
}{- "publishable_api_key": {
- "id": "pk_01G1G5V27GYX4QXNARRQCW1N8T",
- "created_by": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "revoked_by": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "revoked_at": "2019-08-24T14:15:22Z",
- "title": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}Retrieves a list of Regions.
| limit | integer Default: 50 limit the number of regions in response |
| offset | integer Default: 0 Offset of regions in response (used for pagination) |
| created_at | object Date comparison for when resulting region was created, i.e. less than, greater than etc. |
| updated_at | object Date comparison for when resulting region was updated, i.e. less than, greater than etc. |
| deleted_at | object Date comparison for when resulting region was deleted, i.e. less than, greater than etc. |
required | Array of objects (Region) |
| count required | integer The total number of items available |
| offset required | integer The number of items skipped before these items |
| limit required | integer The number of items per page |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.regions.list() .then(({ regions, limit, offset, count }) => { console.log(regions.length); });
{- "regions": [
- {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}Creates a Region
| name required | string The name of the Region |
| currency_code required | |
| tax_rate required | number The tax rate to use on Orders in the Region. |
| payment_providers required | Array of strings A list of Payment Provider IDs that should be enabled for the Region |
| fulfillment_providers required | Array of strings A list of Fulfillment Provider IDs that should be enabled for the Region |
| countries required | Array of strings Example: ["US"] A list of countries' 2 ISO Characters that should be included in the Region. |
| tax_code | string An optional tax code the Region. |
| includes_tax | boolean [EXPERIMENTAL] Tax included in prices of region |
required | object (Region) Regions hold settings for how Customers in a given geographical location shop. The is, for example, where currencies and tax rates are defined. A Region can consist of multiple countries to accomodate common shopping settings across countries. |
{- "name": "string",
- "currency_code": "string",
- "tax_code": "string",
- "tax_rate": 0,
- "payment_providers": [
- "string"
], - "fulfillment_providers": [
- "string"
], - "countries": [
- "US"
], - "includes_tax": true
}{- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "tax_rates": [
- {
- "id": null,
- "rate": null,
- "code": null,
- "name": null,
- "region_id": null,
- "region": { },
- "products": [ ],
- "product_types": [ ],
- "shipping_options": [ ],
- "product_count": null,
- "product_type_count": null,
- "shipping_option_count": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}
], - "tax_provider_id": null,
- "tax_provider": {
- "id": "manual",
- "is_installed": true
}, - "payment_providers": [
- {
- "id": null,
- "is_installed": null
}
], - "fulfillment_providers": [
- {
- "id": null,
- "is_installed": null
}
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Retrieves a Region.
| id required | string The ID of the Region. |
required | object (Region) Regions hold settings for how Customers in a given geographical location shop. The is, for example, where currencies and tax rates are defined. A Region can consist of multiple countries to accomodate common shopping settings across countries. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.regions.retrieve(region_id) .then(({ region }) => { console.log(region.id); });
{- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "tax_rates": [
- {
- "id": null,
- "rate": null,
- "code": null,
- "name": null,
- "region_id": null,
- "region": { },
- "products": [ ],
- "product_types": [ ],
- "shipping_options": [ ],
- "product_count": null,
- "product_type_count": null,
- "shipping_option_count": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}
], - "tax_provider_id": null,
- "tax_provider": {
- "id": "manual",
- "is_installed": true
}, - "payment_providers": [
- {
- "id": null,
- "is_installed": null
}
], - "fulfillment_providers": [
- {
- "id": null,
- "is_installed": null
}
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Updates a Region
| id required | string The ID of the Region. |
| name | string The name of the Region |
| currency_code | |
| automatic_taxes | boolean If true Medusa will automatically calculate taxes for carts in this region. If false you have to manually call POST /carts/:id/taxes. |
| gift_cards_taxable | boolean Whether gift cards in this region should be applied sales tax when purchasing a gift card |
| tax_provider_id | string The ID of the tax provider to use; if null the system tax provider is used |
| tax_code | string An optional tax code the Region. |
| tax_rate | number The tax rate to use on Orders in the Region. |
| includes_tax | boolean [EXPERIMENTAL] Tax included in prices of region |
| payment_providers | Array of strings A list of Payment Provider IDs that should be enabled for the Region |
| fulfillment_providers | Array of strings A list of Fulfillment Provider IDs that should be enabled for the Region |
| countries | Array of strings A list of countries' 2 ISO Characters that should be included in the Region. |
required | object (Region) Regions hold settings for how Customers in a given geographical location shop. The is, for example, where currencies and tax rates are defined. A Region can consist of multiple countries to accomodate common shopping settings across countries. |
{- "name": "string",
- "currency_code": "string",
- "automatic_taxes": true,
- "gift_cards_taxable": true,
- "tax_provider_id": "string",
- "tax_code": "string",
- "tax_rate": 0,
- "includes_tax": true,
- "payment_providers": [
- "string"
], - "fulfillment_providers": [
- "string"
], - "countries": [
- "string"
]
}{- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "tax_rates": [
- {
- "id": null,
- "rate": null,
- "code": null,
- "name": null,
- "region_id": null,
- "region": { },
- "products": [ ],
- "product_types": [ ],
- "shipping_options": [ ],
- "product_count": null,
- "product_type_count": null,
- "shipping_option_count": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}
], - "tax_provider_id": null,
- "tax_provider": {
- "id": "manual",
- "is_installed": true
}, - "payment_providers": [
- {
- "id": null,
- "is_installed": null
}
], - "fulfillment_providers": [
- {
- "id": null,
- "is_installed": null
}
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Deletes a Region.
| id required | string The ID of the Region. |
| id required | string The ID of the deleted Region. |
| object required | string Default: "region" The type of the object that was deleted. |
| deleted required | boolean Default: true Whether or not the items were deleted. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.regions.delete(region_id) .then(({ id, object, deleted }) => { console.log(id); });
{- "id": "string",
- "object": "region",
- "deleted": true
}Adds a Country to the list of Countries in a Region
| id required | string The ID of the Region. |
| country_code required |
required | object (Region) Regions hold settings for how Customers in a given geographical location shop. The is, for example, where currencies and tax rates are defined. A Region can consist of multiple countries to accomodate common shopping settings across countries. |
{- "country_code": "string"
}{- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "tax_rates": [
- {
- "id": null,
- "rate": null,
- "code": null,
- "name": null,
- "region_id": null,
- "region": { },
- "products": [ ],
- "product_types": [ ],
- "shipping_options": [ ],
- "product_count": null,
- "product_type_count": null,
- "shipping_option_count": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}
], - "tax_provider_id": null,
- "tax_provider": {
- "id": "manual",
- "is_installed": true
}, - "payment_providers": [
- {
- "id": null,
- "is_installed": null
}
], - "fulfillment_providers": [
- {
- "id": null,
- "is_installed": null
}
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Removes a Country from the list of Countries in a Region
| id required | string The ID of the Region. |
| country_code required |
required | object (Region) Regions hold settings for how Customers in a given geographical location shop. The is, for example, where currencies and tax rates are defined. A Region can consist of multiple countries to accomodate common shopping settings across countries. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.regions.deleteCountry(region_id, 'dk') .then(({ region }) => { console.log(region.id); });
{- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "tax_rates": [
- {
- "id": null,
- "rate": null,
- "code": null,
- "name": null,
- "region_id": null,
- "region": { },
- "products": [ ],
- "product_types": [ ],
- "shipping_options": [ ],
- "product_count": null,
- "product_type_count": null,
- "shipping_option_count": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}
], - "tax_provider_id": null,
- "tax_provider": {
- "id": "manual",
- "is_installed": true
}, - "payment_providers": [
- {
- "id": null,
- "is_installed": null
}
], - "fulfillment_providers": [
- {
- "id": null,
- "is_installed": null
}
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Gathers all the fulfillment options available to in the Region.
| id required | string The ID of the Region. |
required | Array of objects |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.regions.retrieveFulfillmentOptions(region_id) .then(({ fulfillment_options }) => { console.log(fulfillment_options.length); });
{- "fulfillment_options": [
- {
- "provider_id": "string",
- "options": [
- { }
]
}
]
}Adds a Fulfillment Provider to a Region
| id required | string The ID of the Region. |
| provider_id required | string The ID of the Fulfillment Provider to add. |
required | object (Region) Regions hold settings for how Customers in a given geographical location shop. The is, for example, where currencies and tax rates are defined. A Region can consist of multiple countries to accomodate common shopping settings across countries. |
{- "provider_id": "string"
}{- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "tax_rates": [
- {
- "id": null,
- "rate": null,
- "code": null,
- "name": null,
- "region_id": null,
- "region": { },
- "products": [ ],
- "product_types": [ ],
- "shipping_options": [ ],
- "product_count": null,
- "product_type_count": null,
- "shipping_option_count": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}
], - "tax_provider_id": null,
- "tax_provider": {
- "id": "manual",
- "is_installed": true
}, - "payment_providers": [
- {
- "id": null,
- "is_installed": null
}
], - "fulfillment_providers": [
- {
- "id": null,
- "is_installed": null
}
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Removes a Fulfillment Provider.
| id required | string The ID of the Region. |
| provider_id required | string The ID of the Fulfillment Provider. |
required | object (Region) Regions hold settings for how Customers in a given geographical location shop. The is, for example, where currencies and tax rates are defined. A Region can consist of multiple countries to accomodate common shopping settings across countries. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.regions.deleteFulfillmentProvider(region_id, 'manual') .then(({ region }) => { console.log(region.id); });
{- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "tax_rates": [
- {
- "id": null,
- "rate": null,
- "code": null,
- "name": null,
- "region_id": null,
- "region": { },
- "products": [ ],
- "product_types": [ ],
- "shipping_options": [ ],
- "product_count": null,
- "product_type_count": null,
- "shipping_option_count": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}
], - "tax_provider_id": null,
- "tax_provider": {
- "id": "manual",
- "is_installed": true
}, - "payment_providers": [
- {
- "id": null,
- "is_installed": null
}
], - "fulfillment_providers": [
- {
- "id": null,
- "is_installed": null
}
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Adds a Payment Provider to a Region
| id required | string The ID of the Region. |
| provider_id required | string The ID of the Payment Provider to add. |
required | object (Region) Regions hold settings for how Customers in a given geographical location shop. The is, for example, where currencies and tax rates are defined. A Region can consist of multiple countries to accomodate common shopping settings across countries. |
{- "provider_id": "string"
}{- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "tax_rates": [
- {
- "id": null,
- "rate": null,
- "code": null,
- "name": null,
- "region_id": null,
- "region": { },
- "products": [ ],
- "product_types": [ ],
- "shipping_options": [ ],
- "product_count": null,
- "product_type_count": null,
- "shipping_option_count": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}
], - "tax_provider_id": null,
- "tax_provider": {
- "id": "manual",
- "is_installed": true
}, - "payment_providers": [
- {
- "id": null,
- "is_installed": null
}
], - "fulfillment_providers": [
- {
- "id": null,
- "is_installed": null
}
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Removes a Payment Provider.
| id required | string The ID of the Region. |
| provider_id required | string The ID of the Payment Provider. |
required | object (Region) Regions hold settings for how Customers in a given geographical location shop. The is, for example, where currencies and tax rates are defined. A Region can consist of multiple countries to accomodate common shopping settings across countries. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.regions.deletePaymentProvider(region_id, 'manual') .then(({ region }) => { console.log(region.id); });
{- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "tax_rates": [
- {
- "id": null,
- "rate": null,
- "code": null,
- "name": null,
- "region_id": null,
- "region": { },
- "products": [ ],
- "product_types": [ ],
- "shipping_options": [ ],
- "product_count": null,
- "product_type_count": null,
- "shipping_option_count": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}
], - "tax_provider_id": null,
- "tax_provider": {
- "id": "manual",
- "is_installed": true
}, - "payment_providers": [
- {
- "id": null,
- "is_installed": null
}
], - "fulfillment_providers": [
- {
- "id": null,
- "is_installed": null
}
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Retrieve a list of Reservations.
| location_id | Array of strings Location ids to search for. |
| inventory_item_id | Array of strings Inventory Item ids to search for. |
| line_item_id | Array of strings Line Item ids to search for. |
object Filter by reservation quantity | |
| offset | integer Default: 0 How many Reservations to skip in the result. |
| limit | integer Default: 20 Limit the number of Reservations returned. |
| expand | string (Comma separated) Which fields should be expanded in the product category. |
| fields | string (Comma separated) Which fields should be included in the product category. |
required | Array of objects (Reservation item) |
| count required | integer The total number of items available |
| offset required | integer The number of items skipped before these items |
| limit required | integer The number of items per page |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.reservations.list() .then(({ reservations, count, limit, offset }) => { console.log(reservations.length) })
{- "reservations": [
- {
- "id": "string",
- "location_id": "string",
- "inventory_item_id": "string",
- "description": "string",
- "created_by": "string",
- "quantity": 0,
- "metadata": {
- "car": "white"
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}Create a Reservation which can be associated with any resource as required.
| location_id required | string The id of the location of the reservation |
| inventory_item_id required | string The id of the inventory item the reservation relates to |
| quantity required | number The id of the reservation item |
| line_item_id | string The id of the location of the reservation |
| metadata | object An optional set of key-value pairs with additional information. |
required | object (Reservation item) Represents a reservation of an inventory item at a stock location |
{- "line_item_id": "string",
- "location_id": "string",
- "inventory_item_id": "string",
- "quantity": 0,
- "metadata": { }
}{- "reservation": {
- "id": "string",
- "location_id": "string",
- "inventory_item_id": "string",
- "description": "string",
- "created_by": "string",
- "quantity": 0,
- "metadata": {
- "car": "white"
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}Retrieves a single reservation using its ID
| id required | string The ID of the reservation to retrieve. |
required | object (Reservation item) Represents a reservation of an inventory item at a stock location |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.reservations.retrieve(reservationId) .then(({ reservation }) => { console.log(reservation.id); });
{- "reservation": {
- "id": "string",
- "location_id": "string",
- "inventory_item_id": "string",
- "description": "string",
- "created_by": "string",
- "quantity": 0,
- "metadata": {
- "car": "white"
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}Updates a Reservation which can be associated with any resource as required.
| id required | string The ID of the Reservation to update. |
| location_id | string The id of the location of the reservation |
| quantity | number The id of the reservation item |
| metadata | object An optional set of key-value pairs with additional information. |
required | object (Reservation item) Represents a reservation of an inventory item at a stock location |
{- "location_id": "string",
- "quantity": 0,
- "metadata": { }
}{- "reservation": {
- "id": "string",
- "location_id": "string",
- "inventory_item_id": "string",
- "description": "string",
- "created_by": "string",
- "quantity": 0,
- "metadata": {
- "car": "white"
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}Deletes a Reservation.
| id required | string The ID of the Reservation to delete. |
| id required | string The ID of the deleted Reservation. |
| object required | string Default: "reservation" The type of the object that was deleted. |
| deleted required | boolean Default: true Whether or not the Reservation was deleted. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.reservations.delete(reservationId) .then(({ id, object, deleted }) => { console.log(id); });
{- "id": "string",
- "object": "reservation",
- "deleted": true
}Retrieves a list of Return Reasons.
required | Array of objects (Return Reason) |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.returnReasons.list() .then(({ return_reasons }) => { console.log(return_reasons.length); });
{- "return_reasons": [
- {
- "id": "rr_01G8X82GCCV2KSQHDBHSSAH5TQ",
- "value": "damaged",
- "label": "Damaged goods",
- "description": "Items that are damaged",
- "parent_return_reason_id": null,
- "parent_return_reason": { },
- "return_reason_children": { },
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
]
}Creates a Return Reason
| label required | string The label to display to the Customer. |
| value required | string The value that the Return Reason will be identified by. Must be unique. |
| parent_return_reason_id | string The ID of the parent return reason. |
| description | string An optional description to for the Reason. |
| metadata | object An optional set of key-value pairs with additional information. |
required | object (Return Reason) A Reason for why a given product is returned. A Return Reason can be used on Return Items in order to indicate why a Line Item was returned. |
{- "label": "string",
- "value": "string",
- "parent_return_reason_id": "string",
- "description": "string",
- "metadata": { }
}{- "return_reason": {
- "id": "rr_01G8X82GCCV2KSQHDBHSSAH5TQ",
- "value": "damaged",
- "label": "Damaged goods",
- "description": "Items that are damaged",
- "parent_return_reason_id": null,
- "parent_return_reason": { },
- "return_reason_children": { },
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Retrieves a Return Reason.
| id required | string The ID of the Return Reason. |
required | object (Return Reason) A Reason for why a given product is returned. A Return Reason can be used on Return Items in order to indicate why a Line Item was returned. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.returnReasons.retrieve(return_reason_id) .then(({ return_reason }) => { console.log(return_reason.id); });
{- "return_reason": {
- "id": "rr_01G8X82GCCV2KSQHDBHSSAH5TQ",
- "value": "damaged",
- "label": "Damaged goods",
- "description": "Items that are damaged",
- "parent_return_reason_id": null,
- "parent_return_reason": { },
- "return_reason_children": { },
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Updates a Return Reason
| id required | string The ID of the Return Reason. |
| label | string The label to display to the Customer. |
| value | string The value that the Return Reason will be identified by. Must be unique. |
| description | string An optional description to for the Reason. |
| metadata | object An optional set of key-value pairs with additional information. |
required | object (Return Reason) A Reason for why a given product is returned. A Return Reason can be used on Return Items in order to indicate why a Line Item was returned. |
{- "label": "string",
- "value": "string",
- "description": "string",
- "metadata": { }
}{- "return_reason": {
- "id": "rr_01G8X82GCCV2KSQHDBHSSAH5TQ",
- "value": "damaged",
- "label": "Damaged goods",
- "description": "Items that are damaged",
- "parent_return_reason_id": null,
- "parent_return_reason": { },
- "return_reason_children": { },
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Deletes a return reason.
| id required | string The ID of the return reason |
| id required | string The ID of the deleted return reason |
| object required | string Default: "return_reason" The type of the object that was deleted. |
| deleted required | boolean Default: true Whether or not the items were deleted. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.returnReasons.delete(return_reason_id) .then(({ id, object, deleted }) => { console.log(id); });
{- "id": "string",
- "object": "return_reason",
- "deleted": true
}Retrieves a list of Returns
| limit | number Default: "50" The upper limit for the amount of responses returned. |
| offset | number Default: "0" The offset of the list returned. |
required | Array of objects (Return) |
| count required | integer The total number of items available |
| offset required | integer The number of items skipped before these items |
| limit required | integer The number of items per page |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.returns.list() .then(({ returns, limit, offset, count }) => { console.log(returns.length); });
{- "returns": [
- {
- "id": "ret_01F0YET7XPCMF8RZ0Y151NZV2V",
- "status": "requested",
- "items": [
- null
], - "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "shipping_method": {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}, - "shipping_data": { },
- "location_id": "sloc_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "refund_amount": 1000,
- "no_notification": false,
- "idempotency_key": "string",
- "received_at": "2019-08-24T14:15:22Z",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}Registers a Return as canceled.
| id required | string The ID of the Return. |
required | object (Order) Represents an order |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.returns.cancel(return_id) .then(({ order }) => { console.log(order.id); });
{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Registers a Return as received. Updates statuses on Orders and Swaps accordingly.
| id required | string The ID of the Return. |
required | Array of objects The Line Items that have been received. |
| refund | number The amount to refund. |
required | object (Return) Return orders hold information about Line Items that a Customer wishes to send back, along with how the items will be returned. Returns can be used as part of a Swap. |
{- "items": [
- {
- "item_id": "string",
- "quantity": 0
}
], - "refund": 0
}{- "return": {
- "id": "ret_01F0YET7XPCMF8RZ0Y151NZV2V",
- "status": "requested",
- "items": [
- {
- "return_id": null,
- "item_id": null,
- "return_order": { },
- "item": null,
- "quantity": null,
- "is_requested": null,
- "requested_quantity": null,
- "received_quantity": null,
- "reason_id": null,
- "reason": null,
- "note": null,
- "metadata": { }
}
], - "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "shipping_method": {
- "id": "sm_01F0YET7DR2E7CYVSDHM593QG2",
- "shipping_option_id": "so_01G1G5V27GYX4QXNARRQCW1N8T",
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": {
- "id": null,
- "name": null,
- "region_id": null,
- "region": { },
- "profile_id": null,
- "profile": null,
- "provider_id": null,
- "provider": null,
- "price_type": null,
- "amount": null,
- "is_return": null,
- "admin_only": null,
- "requirements": [ ],
- "data": { },
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "tax_lines": [
- null
], - "price": 200,
- "data": { },
- "includes_tax": false,
- "subtotal": 8000,
- "total": 8200,
- "tax_total": 0
}, - "shipping_data": { },
- "location_id": "sloc_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "refund_amount": 1000,
- "no_notification": false,
- "idempotency_key": "string",
- "received_at": "2019-08-24T14:15:22Z",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Retrieves a list of sales channels
| id | string ID of the sales channel |
| name | string Name of the sales channel |
| description | string Description of the sales channel |
| q | string Query used for searching sales channels' names and descriptions. |
| order | string The field to order the results by. |
object Date comparison for when resulting collections were created. | |
object Date comparison for when resulting collections were updated. | |
object Date comparison for when resulting collections were deleted. | |
| offset | integer Default: 0 How many sales channels to skip in the result. |
| limit | integer Default: 20 Limit the number of sales channels returned. |
| expand | string (Comma separated) Which fields should be expanded in each sales channel of the result. |
| fields | string (Comma separated) Which fields should be included in each sales channel of the result. |
required | Array of objects (Sales Channel) |
| count required | integer The total number of items available |
| offset required | integer The number of items skipped before these items |
| limit required | integer The number of items per page |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.salesChannels.list() .then(({ sales_channels, limit, offset, count }) => { console.log(sales_channels.length); });
{- "sales_channels": [
- {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}Creates a Sales Channel.
| name required | string The name of the Sales Channel |
| description | string The description of the Sales Channel |
| is_disabled | boolean Whether the Sales Channel is disabled or not. |
required | object (Sales Channel) A Sales Channel |
{- "name": "string",
- "description": "string",
- "is_disabled": true
}{- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- {
- "id": null,
- "sales_channel_id": null,
- "location_id": null,
- "sales_channel": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}Retrieves the sales channel.
| id required | string The ID of the Sales channel. |
required | object (Sales Channel) A Sales Channel |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.salesChannels.retrieve(sales_channel_id) .then(({ sales_channel }) => { console.log(sales_channel.id); });
{- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- {
- "id": null,
- "sales_channel_id": null,
- "location_id": null,
- "sales_channel": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}Updates a Sales Channel.
| id required | string The ID of the Sales Channel. |
| name | string Name of the sales channel. |
| description | string Sales Channel description. |
| is_disabled | boolean Indication of if the sales channel is active. |
required | object (Sales Channel) A Sales Channel |
{- "name": "string",
- "description": "string",
- "is_disabled": true
}{- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- {
- "id": null,
- "sales_channel_id": null,
- "location_id": null,
- "sales_channel": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}Deletes the sales channel.
| id required | string The ID of the Sales channel. |
| id required | string The ID of the deleted sales channel |
| object required | string Default: "sales-channel" The type of the object that was deleted. |
| deleted required | boolean Default: true Whether or not the items were deleted. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.salesChannels.delete(sales_channel_id) .then(({ id, object, deleted }) => { console.log(id); });
{- "id": "string",
- "object": "sales-channel",
- "deleted": true
}Assign a batch of product to a sales channel.
| id required | string The ID of the Sales channel. |
required | Array of objects The IDs of the products to add to the Sales Channel |
required | object (Sales Channel) A Sales Channel |
{- "product_ids": [
- {
- "id": "string"
}
]
}{- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- {
- "id": null,
- "sales_channel_id": null,
- "location_id": null,
- "sales_channel": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}Remove a list of products from a sales channel.
| id required | string The ID of the Sales Channel |
required | Array of objects The IDs of the products to delete from the Sales Channel. |
required | object (Sales Channel) A Sales Channel |
{- "product_ids": [
- {
- "id": "string"
}
]
}{- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- {
- "id": null,
- "sales_channel_id": null,
- "location_id": null,
- "sales_channel": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}Associates a stock location with a Sales Channel.
| id required | string The ID of the Sales Channel. |
| location_id required | string The ID of the stock location |
required | object (Sales Channel) A Sales Channel |
{- "location_id": "string"
}{- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- {
- "id": null,
- "sales_channel_id": null,
- "location_id": null,
- "sales_channel": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}Removes a stock location from a Sales Channel.
| id required | string The ID of the Sales Channel. |
| location_id required | string The ID of the stock location |
| id required | string The ID of the removed stock location from a sales channel |
| object required | string Default: "stock-location" The type of the object that was removed. |
| deleted required | boolean Default: true Whether or not the items were deleted. |
{- "location_id": "string"
}{- "id": "string",
- "object": "stock-location",
- "deleted": true
}Retrieves a list of Shipping Options.
| region_id | string Region ID to fetch options from |
| is_return | boolean Flag for fetching return options only |
| admin_only | boolean Flag for fetching admin specific options |
required | Array of objects (Shipping Option) |
| count required | integer The total number of items available |
| offset required | integer The number of items skipped before these items |
| limit required | integer The number of items per page |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.shippingOptions.list() .then(({ shipping_options, count }) => { console.log(shipping_options.length); });
{- "shipping_options": [
- {
- "id": "so_01G1G5V27GYX4QXNARRQCW1N8T",
- "name": "PostFake Standard",
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": { },
- "profile_id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "profile": {
- "id": null,
- "name": null,
- "type": null,
- "products": [ ],
- "shipping_options": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "provider_id": "manual",
- "provider": {
- "id": null,
- "is_installed": null
}, - "price_type": "flat_rate",
- "amount": 200,
- "is_return": false,
- "admin_only": false,
- "requirements": [
- null
], - "data": { },
- "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}Creates a Shipping Option
| name required | string The name of the Shipping Option |
| region_id required | string The ID of the Region in which the Shipping Option will be available. |
| provider_id required | string The ID of the Fulfillment Provider that handles the Shipping Option. |
| data required | object The data needed for the Fulfillment Provider to handle shipping with this Shipping Option. |
| price_type required | string Enum: "flat_rate" "calculated" The type of the Shipping Option price. |
| profile_id | number The ID of the Shipping Profile to add the Shipping Option to. |
| amount | integer The amount to charge for the Shipping Option. |
Array of objects The requirements that must be satisfied for the Shipping Option to be available. | |
| is_return | boolean Default: false Whether the Shipping Option defines a return shipment. |
| admin_only | boolean Default: false If true, the option can be used for draft orders |
| metadata | object An optional set of key-value pairs with additional information. |
| includes_tax | boolean [EXPERIMENTAL] Tax included in prices of shipping option |
required | object (Shipping Option) Shipping Options represent a way in which an Order or Return can be shipped. Shipping Options have an associated Fulfillment Provider that will be used when the fulfillment of an Order is initiated. Shipping Options themselves cannot be added to Carts, but serve as a template for Shipping Methods. This distinction makes it possible to customize individual Shipping Methods with additional information. |
{- "name": "string",
- "region_id": "string",
- "provider_id": "string",
- "profile_id": 0,
- "data": { },
- "price_type": "flat_rate",
- "amount": 0,
- "requirements": [
- {
- "type": "max_subtotal",
- "amount": 0
}
], - "is_return": false,
- "admin_only": false,
- "metadata": { },
- "includes_tax": true
}{- "shipping_option": {
- "id": "so_01G1G5V27GYX4QXNARRQCW1N8T",
- "name": "PostFake Standard",
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": { },
- "profile_id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "profile": {
- "id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "name": "Default Shipping Profile",
- "type": "default",
- "products": [
- { }
], - "shipping_options": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "provider_id": "manual",
- "provider": {
- "id": "manual",
- "is_installed": true
}, - "price_type": "flat_rate",
- "amount": 200,
- "is_return": false,
- "admin_only": false,
- "requirements": [
- {
- "id": null,
- "shipping_option_id": null,
- "shipping_option": { },
- "type": null,
- "amount": null,
- "deleted_at": null
}
], - "data": { },
- "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Retrieves a Shipping Option.
| id required | string The ID of the Shipping Option. |
required | object (Shipping Option) Shipping Options represent a way in which an Order or Return can be shipped. Shipping Options have an associated Fulfillment Provider that will be used when the fulfillment of an Order is initiated. Shipping Options themselves cannot be added to Carts, but serve as a template for Shipping Methods. This distinction makes it possible to customize individual Shipping Methods with additional information. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.shippingOptions.retrieve(option_id) .then(({ shipping_option }) => { console.log(shipping_option.id); });
{- "shipping_option": {
- "id": "so_01G1G5V27GYX4QXNARRQCW1N8T",
- "name": "PostFake Standard",
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": { },
- "profile_id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "profile": {
- "id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "name": "Default Shipping Profile",
- "type": "default",
- "products": [
- { }
], - "shipping_options": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "provider_id": "manual",
- "provider": {
- "id": "manual",
- "is_installed": true
}, - "price_type": "flat_rate",
- "amount": 200,
- "is_return": false,
- "admin_only": false,
- "requirements": [
- {
- "id": null,
- "shipping_option_id": null,
- "shipping_option": { },
- "type": null,
- "amount": null,
- "deleted_at": null
}
], - "data": { },
- "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Updates a Shipping Option
| id required | string The ID of the Shipping Option. |
required | Array of objects The requirements that must be satisfied for the Shipping Option to be available. |
| name | string The name of the Shipping Option |
| amount | integer The amount to charge for the Shipping Option. |
| admin_only | boolean If true, the option can be used for draft orders |
| metadata | object An optional set of key-value pairs with additional information. |
| includes_tax | boolean [EXPERIMENTAL] Tax included in prices of shipping option |
required | object (Shipping Option) Shipping Options represent a way in which an Order or Return can be shipped. Shipping Options have an associated Fulfillment Provider that will be used when the fulfillment of an Order is initiated. Shipping Options themselves cannot be added to Carts, but serve as a template for Shipping Methods. This distinction makes it possible to customize individual Shipping Methods with additional information. |
{- "name": "string",
- "amount": 0,
- "admin_only": true,
- "metadata": { },
- "requirements": [
- {
- "id": "string",
- "type": "max_subtotal",
- "amount": 0
}
], - "includes_tax": true
}{- "shipping_option": {
- "id": "so_01G1G5V27GYX4QXNARRQCW1N8T",
- "name": "PostFake Standard",
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": { },
- "profile_id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "profile": {
- "id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "name": "Default Shipping Profile",
- "type": "default",
- "products": [
- { }
], - "shipping_options": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "provider_id": "manual",
- "provider": {
- "id": "manual",
- "is_installed": true
}, - "price_type": "flat_rate",
- "amount": 200,
- "is_return": false,
- "admin_only": false,
- "requirements": [
- {
- "id": null,
- "shipping_option_id": null,
- "shipping_option": { },
- "type": null,
- "amount": null,
- "deleted_at": null
}
], - "data": { },
- "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Deletes a Shipping Option.
| id required | string The ID of the Shipping Option. |
| id required | string The ID of the deleted Shipping Option. |
| object required | string Default: "shipping-option" The type of the object that was deleted. |
| deleted required | boolean Default: true Whether or not the items were deleted. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.shippingOptions.delete(option_id) .then(({ id, object, deleted }) => { console.log(id); });
{- "id": "string",
- "object": "shipping-option",
- "deleted": true
}Retrieves a list of Shipping Profile.
required | Array of objects (Shipping Profile) |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.shippingProfiles.list() .then(({ shipping_profiles }) => { console.log(shipping_profiles.length); });
{- "shipping_profiles": [
- {
- "id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "name": "Default Shipping Profile",
- "type": "default",
- "products": [
- { }
], - "shipping_options": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
]
}Creates a Shipping Profile
| name required | string The name of the Shipping Profile |
| type required | string Enum: "default" "gift_card" "custom" The type of the Shipping Profile |
required | object (Shipping Profile) Shipping Profiles have a set of defined Shipping Options that can be used to fulfill a given set of Products. |
{- "name": "string",
- "type": "default"
}{- "shipping_profile": {
- "id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "name": "Default Shipping Profile",
- "type": "default",
- "products": [
- { }
], - "shipping_options": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Retrieves a Shipping Profile.
| id required | string The ID of the Shipping Profile. |
required | object (Shipping Profile) Shipping Profiles have a set of defined Shipping Options that can be used to fulfill a given set of Products. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.shippingProfiles.retrieve(profile_id) .then(({ shipping_profile }) => { console.log(shipping_profile.id); });
{- "shipping_profile": {
- "id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "name": "Default Shipping Profile",
- "type": "default",
- "products": [
- { }
], - "shipping_options": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Updates a Shipping Profile
| id required | string The ID of the Shipping Profile. |
| name | string The name of the Shipping Profile |
| metadata | object An optional set of key-value pairs with additional information. |
| type | string Enum: "default" "gift_card" "custom" The type of the Shipping Profile |
| products | Array of arrays An optional array of product ids to associate with the Shipping Profile |
| shipping_options | Array of arrays An optional array of shipping option ids to associate with the Shipping Profile |
required | object (Shipping Profile) Shipping Profiles have a set of defined Shipping Options that can be used to fulfill a given set of Products. |
{- "name": "string",
- "metadata": { },
- "type": "default",
- "products": [ ],
- "shipping_options": [ ]
}{- "shipping_profile": {
- "id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "name": "Default Shipping Profile",
- "type": "default",
- "products": [
- { }
], - "shipping_options": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Deletes a Shipping Profile.
| id required | string The ID of the Shipping Profile. |
| id required | string The ID of the deleted Shipping Profile. |
| object required | string Default: "shipping_profile" The type of the object that was deleted. |
| deleted required | boolean Default: true Whether or not the items were deleted. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.shippingProfiles.delete(profile_id) .then(({ id, object, deleted }) => { console.log(id); });
{- "id": "string",
- "object": "shipping_profile",
- "deleted": true
}Retrieves a list of stock locations
| id | string ID of the stock location |
| name | string Name of the stock location |
| order | string The field to order the results by. |
object Date comparison for when resulting collections were created. | |
object Date comparison for when resulting collections were updated. | |
object Date comparison for when resulting collections were deleted. | |
| offset | integer Default: 0 How many stock locations to skip in the result. |
| limit | integer Default: 20 Limit the number of stock locations returned. |
| expand | string (Comma separated) Which fields should be expanded in each stock location of the result. |
| fields | string (Comma separated) Which fields should be included in each stock location of the result. |
required | Array of objects (StockLocationExpandedDTO) |
| count required | integer The total number of items available |
| offset required | integer The number of items skipped before these items |
| limit required | integer The number of items per page |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.stockLocations.list() .then(({ stock_locations, limit, offset, count }) => { console.log(stock_locations.length); });
{- "stock_locations": [
- {
- "id": "sloc_51G4ZW853Y6TFXWPG5ENJ81X42",
- "address_id": "laddr_05B2ZE853Y6FTXWPW85NJ81A44",
- "name": "Main Warehouse",
- "address": {
- "id": null,
- "address_1": null,
- "address_2": null,
- "company": null,
- "city": null,
- "country_code": null,
- "phone": null,
- "postal_code": null,
- "province": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "metadata": {
- "car": "white"
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "sales_channels": {
- "id": null,
- "name": null,
- "description": null,
- "is_disabled": null,
- "locations": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}Creates a Stock Location.
| expand | string Comma separated list of relations to include in the results. |
| fields | string Comma separated list of fields to include in the results. |
| name required | string the name of the stock location |
| address_id | string the stock location address ID |
| metadata | object Example: {"car":"white"} An optional key-value map with additional details |
object (Stock Location Address Input) Represents a Stock Location Address Input |
required | object (StockLocationExpandedDTO) Represents a Stock Location |
{- "name": "string",
- "address_id": "string",
- "metadata": {
- "car": "white"
}, - "address": {
- "address_1": "35, Jhon Doe Ave",
- "address_2": "apartment 4432",
- "city": "Mexico city",
- "country_code": "MX",
- "phone": "+1 555 61646",
- "postal_code": "HD3-1G8",
- "province": "Sinaloa",
- "metadata": {
- "car": "white"
}
}
}{- "stock_location": {
- "id": "sloc_51G4ZW853Y6TFXWPG5ENJ81X42",
- "address_id": "laddr_05B2ZE853Y6FTXWPW85NJ81A44",
- "name": "Main Warehouse",
- "address": {
- "id": "laddr_51G4ZW853Y6TFXWPG5ENJ81X42",
- "address_1": "35, Jhon Doe Ave",
- "address_2": "apartment 4432",
- "company": "Medusa",
- "city": "Mexico city",
- "country_code": "MX",
- "phone": "+1 555 61646",
- "postal_code": "HD3-1G8",
- "province": "Sinaloa",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "metadata": {
- "car": "white"
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "sales_channels": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}
}Retrieves the Stock Location.
| id required | string The ID of the Stock Location. |
| expand | string Comma separated list of relations to include in the results. |
| fields | string Comma separated list of fields to include in the results. |
required | object (StockLocationExpandedDTO) Represents a Stock Location |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.stockLocations.retrieve(stockLocationId) .then(({ stock_location }) => { console.log(stock_location.id); });
{- "stock_location": {
- "id": "sloc_51G4ZW853Y6TFXWPG5ENJ81X42",
- "address_id": "laddr_05B2ZE853Y6FTXWPW85NJ81A44",
- "name": "Main Warehouse",
- "address": {
- "id": "laddr_51G4ZW853Y6TFXWPG5ENJ81X42",
- "address_1": "35, Jhon Doe Ave",
- "address_2": "apartment 4432",
- "company": "Medusa",
- "city": "Mexico city",
- "country_code": "MX",
- "phone": "+1 555 61646",
- "postal_code": "HD3-1G8",
- "province": "Sinaloa",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "metadata": {
- "car": "white"
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "sales_channels": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}
}Updates a Stock Location.
| id required | string The ID of the Stock Location. |
| expand | string Comma separated list of relations to include in the results. |
| fields | string Comma separated list of fields to include in the results. |
| name | string the name of the stock location |
| address_id | string the stock location address ID |
| metadata | object Example: {"car":"white"} An optional key-value map with additional details |
object (Stock Location Address Input) Represents a Stock Location Address Input |
required | object (StockLocationExpandedDTO) Represents a Stock Location |
{- "name": "string",
- "address_id": "string",
- "metadata": {
- "car": "white"
}, - "address": {
- "address_1": "35, Jhon Doe Ave",
- "address_2": "apartment 4432",
- "city": "Mexico city",
- "country_code": "MX",
- "phone": "+1 555 61646",
- "postal_code": "HD3-1G8",
- "province": "Sinaloa",
- "metadata": {
- "car": "white"
}
}
}{- "stock_location": {
- "id": "sloc_51G4ZW853Y6TFXWPG5ENJ81X42",
- "address_id": "laddr_05B2ZE853Y6FTXWPW85NJ81A44",
- "name": "Main Warehouse",
- "address": {
- "id": "laddr_51G4ZW853Y6TFXWPG5ENJ81X42",
- "address_1": "35, Jhon Doe Ave",
- "address_2": "apartment 4432",
- "company": "Medusa",
- "city": "Mexico city",
- "country_code": "MX",
- "phone": "+1 555 61646",
- "postal_code": "HD3-1G8",
- "province": "Sinaloa",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "metadata": {
- "car": "white"
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "sales_channels": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}
}Delete a Stock Location
| id required | string The ID of the Stock Location to delete. |
| id | string The ID of the deleted Stock Location. |
| object | string <stock_location> The type of the object that was deleted. |
| deleted | boolean Default: true Whether or not the Stock Location was deleted. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.stockLocations.delete(stock_location_id) .then(({ id, object, deleted }) => { console.log(id) })
{- "id": "string",
- "object": "string",
- "deleted": true
}Retrieves the Store details
required | object (ExtendedStoreDTO) Holds settings for the Store, such as name, currencies, etc. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.store.retrieve() .then(({ store }) => { console.log(store.id); });
{- "store": {
- "id": "store_01G1G5V21KADXNGH29BJMAJ4B4",
- "name": "Medusa Store",
- "default_currency_code": "usd",
- "default_currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "currencies": [
- {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}
], - "swap_link_template": null,
- "payment_link_template": null,
- "invite_link_template": null,
- "default_location_id": null,
- "default_sales_channel_id": null,
- "default_sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}, - "payment_providers": {
- "id": "manual",
- "is_installed": true
}, - "fulfillment_providers": {
- "id": "manual",
- "is_installed": true
}, - "feature_flags": [
- {
- "key": null,
- "value": null
}
], - "modules": [
- {
- "module": null,
- "resolution": null
}
]
}
}Updates the Store details
| name | string The name of the Store |
| swap_link_template | string A template for Swap links - use |
| payment_link_template | string A template for payment links links - use |
| invite_link_template | string A template for invite links - use |
| default_currency_code | |
| currencies | Array of strings Array of currencies in 2 character ISO code format. |
| metadata | object An optional set of key-value pairs with additional information. |
required | object (Store) Holds settings for the Store, such as name, currencies, etc. |
{- "name": "string",
- "swap_link_template": "string",
- "payment_link_template": "string",
- "invite_link_template": "string",
- "default_currency_code": "string",
- "currencies": [
- "string"
], - "metadata": { }
}{- "store": {
- "id": "store_01G1G5V21KADXNGH29BJMAJ4B4",
- "name": "Medusa Store",
- "default_currency_code": "usd",
- "default_currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "currencies": [
- {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}
], - "swap_link_template": null,
- "payment_link_template": null,
- "invite_link_template": null,
- "default_location_id": null,
- "default_sales_channel_id": null,
- "default_sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Adds a Currency Code to the available currencies.
| code required |
required | object (Store) Holds settings for the Store, such as name, currencies, etc. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.store.addCurrency('eur') .then(({ store }) => { console.log(store.currencies); });
{- "store": {
- "id": "store_01G1G5V21KADXNGH29BJMAJ4B4",
- "name": "Medusa Store",
- "default_currency_code": "usd",
- "default_currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "currencies": [
- {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}
], - "swap_link_template": null,
- "payment_link_template": null,
- "invite_link_template": null,
- "default_location_id": null,
- "default_sales_channel_id": null,
- "default_sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Removes a Currency Code from the available currencies.
| code required |
required | object (Store) Holds settings for the Store, such as name, currencies, etc. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.store.deleteCurrency('eur') .then(({ store }) => { console.log(store.currencies); });
{- "store": {
- "id": "store_01G1G5V21KADXNGH29BJMAJ4B4",
- "name": "Medusa Store",
- "default_currency_code": "usd",
- "default_currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "currencies": [
- {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}
], - "swap_link_template": null,
- "payment_link_template": null,
- "invite_link_template": null,
- "default_location_id": null,
- "default_sales_channel_id": null,
- "default_sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Retrieves the configured Payment Providers
required | Array of objects (Payment Provider) |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.store.listPaymentProviders() .then(({ payment_providers }) => { console.log(payment_providers.length); });
{- "payment_providers": [
- {
- "id": "manual",
- "is_installed": true
}
]
}Retrieves the configured Tax Providers
required | Array of objects (Tax Provider) |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.store.listTaxProviders() .then(({ tax_providers }) => { console.log(tax_providers.length); });
{- "tax_providers": [
- {
- "id": "manual",
- "is_installed": true
}
]
}Retrieves a list of Swaps.
| limit | number Default: "50" The upper limit for the amount of responses returned. |
| offset | number Default: "0" The offset of the list returned. |
required | Array of objects (Swap) |
| count required | integer The total number of items available |
| offset required | integer The number of items skipped before these items |
| limit required | integer The number of items per page |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.swaps.list() .then(({ swaps }) => { console.log(swaps.length); });
{- "swaps": [
- {
- "id": "swap_01F0YET86Y9G92D3YDR9Y6V676",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "additional_items": [
- null
], - "return_order": { },
- "fulfillments": [
- { }
], - "payment": { },
- "difference_due": 0,
- "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": null,
- "customer_id": null,
- "customer": { },
- "company": null,
- "first_name": null,
- "last_name": null,
- "address_1": null,
- "address_2": null,
- "city": null,
- "country_code": null,
- "country": null,
- "province": null,
- "postal_code": null,
- "phone": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "shipping_methods": [
- null
], - "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "confirmed_at": "2019-08-24T14:15:22Z",
- "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "allow_backorder": false,
- "idempotency_key": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}Retrieves a Swap.
| id required | string The ID of the Swap. |
required | object (Swap) Swaps can be created when a Customer wishes to exchange Products that they have purchased to different Products. Swaps consist of a Return of previously purchased Products and a Fulfillment of new Products, the amount paid for the Products being returned will be used towards payment for the new Products. In the case where the amount paid for the the Products being returned exceed the amount to be paid for the new Products, a Refund will be issued for the difference. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.swaps.retrieve(swap_id) .then(({ swap }) => { console.log(swap.id); });
{- "swap": {
- "id": "swap_01F0YET86Y9G92D3YDR9Y6V676",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "additional_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "return_order": { },
- "fulfillments": [
- { }
], - "payment": { },
- "difference_due": 0,
- "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "confirmed_at": "2019-08-24T14:15:22Z",
- "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "allow_backorder": false,
- "idempotency_key": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Retrieves a list of TaxRates
| name | string Name of tax rate to retrieve |
string or Array of strings Filter by Region ID | |
| code | string code to search for. |
number or object Filter by Rate | |
| offset | integer Default: 0 How many tax rates to skip before retrieving the result. |
| limit | integer Default: 50 Limit the number of tax rates returned. |
| fields | Array of strings Which fields should be included in each item. |
| expand | Array of strings Which fields should be expanded and retrieved for each item. |
required | Array of objects (Tax Rate) |
| count required | integer The total number of items available |
| offset required | integer The number of items skipped before these items |
| limit required | integer The number of items per page |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.taxRates.list() .then(({ tax_rates, limit, offset, count }) => { console.log(tax_rates.length); });
{- "tax_rates": [
- {
- "id": "txr_01G8XDBAWKBHHJRKH0AV02KXBR",
- "rate": 10,
- "code": "tax01",
- "name": "Tax Example",
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": { },
- "products": [
- null
], - "product_types": [
- null
], - "shipping_options": [
- null
], - "product_count": 10,
- "product_type_count": 2,
- "shipping_option_count": 1,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}Creates a Tax Rate
| fields | Array of strings Which fields should be included in the result. |
| expand | Array of strings Which fields should be expanded and retrieved in the result. |
| code required | string A code to identify the tax type by |
| name required | string A human friendly name for the tax |
| region_id required | string The ID of the Region that the rate belongs to |
| rate | number The numeric rate to charge |
| products | Array of strings The IDs of the products associated with this tax rate |
| shipping_options | Array of strings The IDs of the shipping options associated with this tax rate |
| product_types | Array of strings The IDs of the types of products associated with this tax rate |
required | object (Tax Rate) A Tax Rate can be used to associate a certain rate to charge on products within a given Region |
{- "code": "string",
- "name": "string",
- "region_id": "string",
- "rate": 0,
- "products": [
- "string"
], - "shipping_options": [
- "string"
], - "product_types": [
- "string"
]
}{- "tax_rate": {
- "id": "txr_01G8XDBAWKBHHJRKH0AV02KXBR",
- "rate": 10,
- "code": "tax01",
- "name": "Tax Example",
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": { },
- "products": [
- {
- "id": null,
- "title": null,
- "subtitle": null,
- "description": null,
- "handle": null,
- "is_giftcard": null,
- "status": null,
- "images": [ ],
- "thumbnail": null,
- "options": [ ],
- "variants": [ ],
- "categories": [ ],
- "profile_id": null,
- "profile": null,
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": null,
- "collection": null,
- "type_id": null,
- "type": null,
- "tags": [ ],
- "discountable": null,
- "external_id": null,
- "sales_channels": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "product_types": [
- {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_options": [
- {
- "id": null,
- "name": null,
- "region_id": null,
- "region": { },
- "profile_id": null,
- "profile": null,
- "provider_id": null,
- "provider": null,
- "price_type": null,
- "amount": null,
- "is_return": null,
- "admin_only": null,
- "requirements": [ ],
- "data": { },
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "product_count": 10,
- "product_type_count": 2,
- "shipping_option_count": 1,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Retrieves a TaxRate
| id required | string ID of the tax rate. |
| fields | Array of strings Which fields should be included in the result. |
| expand | Array of strings Which fields should be expanded and retrieved in the result. |
required | object (Tax Rate) A Tax Rate can be used to associate a certain rate to charge on products within a given Region |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.taxRates.retrieve(tax_rate_id) .then(({ tax_rate }) => { console.log(tax_rate.id); });
{- "tax_rate": {
- "id": "txr_01G8XDBAWKBHHJRKH0AV02KXBR",
- "rate": 10,
- "code": "tax01",
- "name": "Tax Example",
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": { },
- "products": [
- {
- "id": null,
- "title": null,
- "subtitle": null,
- "description": null,
- "handle": null,
- "is_giftcard": null,
- "status": null,
- "images": [ ],
- "thumbnail": null,
- "options": [ ],
- "variants": [ ],
- "categories": [ ],
- "profile_id": null,
- "profile": null,
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": null,
- "collection": null,
- "type_id": null,
- "type": null,
- "tags": [ ],
- "discountable": null,
- "external_id": null,
- "sales_channels": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "product_types": [
- {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_options": [
- {
- "id": null,
- "name": null,
- "region_id": null,
- "region": { },
- "profile_id": null,
- "profile": null,
- "provider_id": null,
- "provider": null,
- "price_type": null,
- "amount": null,
- "is_return": null,
- "admin_only": null,
- "requirements": [ ],
- "data": { },
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "product_count": 10,
- "product_type_count": 2,
- "shipping_option_count": 1,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Updates a Tax Rate
| id required | string ID of the tax rate. |
| fields | Array of strings Which fields should be included in the result. |
| expand | Array of strings Which fields should be expanded and retrieved in the result. |
| code | string A code to identify the tax type by |
| name | string A human friendly name for the tax |
| region_id | string The ID of the Region that the rate belongs to |
| rate | number The numeric rate to charge |
| products | Array of strings The IDs of the products associated with this tax rate |
| shipping_options | Array of strings The IDs of the shipping options associated with this tax rate |
| product_types | Array of strings The IDs of the types of products associated with this tax rate |
required | object (Tax Rate) A Tax Rate can be used to associate a certain rate to charge on products within a given Region |
{- "code": "string",
- "name": "string",
- "region_id": "string",
- "rate": 0,
- "products": [
- "string"
], - "shipping_options": [
- "string"
], - "product_types": [
- "string"
]
}{- "tax_rate": {
- "id": "txr_01G8XDBAWKBHHJRKH0AV02KXBR",
- "rate": 10,
- "code": "tax01",
- "name": "Tax Example",
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": { },
- "products": [
- {
- "id": null,
- "title": null,
- "subtitle": null,
- "description": null,
- "handle": null,
- "is_giftcard": null,
- "status": null,
- "images": [ ],
- "thumbnail": null,
- "options": [ ],
- "variants": [ ],
- "categories": [ ],
- "profile_id": null,
- "profile": null,
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": null,
- "collection": null,
- "type_id": null,
- "type": null,
- "tags": [ ],
- "discountable": null,
- "external_id": null,
- "sales_channels": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "product_types": [
- {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_options": [
- {
- "id": null,
- "name": null,
- "region_id": null,
- "region": { },
- "profile_id": null,
- "profile": null,
- "provider_id": null,
- "provider": null,
- "price_type": null,
- "amount": null,
- "is_return": null,
- "admin_only": null,
- "requirements": [ ],
- "data": { },
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "product_count": 10,
- "product_type_count": 2,
- "shipping_option_count": 1,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Deletes a Tax Rate
| id required | string The ID of the Shipping Option. |
| id required | string The ID of the deleted Shipping Option. |
| object required | string Default: "tax-rate" The type of the object that was deleted. |
| deleted required | boolean Default: true Whether or not the items were deleted. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.taxRates.delete(tax_rate_id) .then(({ id, object, deleted }) => { console.log(id); });
{- "id": "string",
- "object": "tax-rate",
- "deleted": true
}Associates a Tax Rate with a list of Product Types
| id required | string ID of the tax rate. |
| fields | Array of strings Which fields should be included in the result. |
| expand | Array of strings Which fields should be expanded and retrieved in the result. |
| product_types required | Array of strings The IDs of the types of products to associate with this tax rate |
required | object (Tax Rate) A Tax Rate can be used to associate a certain rate to charge on products within a given Region |
{- "product_types": [
- "string"
]
}{- "tax_rate": {
- "id": "txr_01G8XDBAWKBHHJRKH0AV02KXBR",
- "rate": 10,
- "code": "tax01",
- "name": "Tax Example",
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": { },
- "products": [
- {
- "id": null,
- "title": null,
- "subtitle": null,
- "description": null,
- "handle": null,
- "is_giftcard": null,
- "status": null,
- "images": [ ],
- "thumbnail": null,
- "options": [ ],
- "variants": [ ],
- "categories": [ ],
- "profile_id": null,
- "profile": null,
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": null,
- "collection": null,
- "type_id": null,
- "type": null,
- "tags": [ ],
- "discountable": null,
- "external_id": null,
- "sales_channels": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "product_types": [
- {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_options": [
- {
- "id": null,
- "name": null,
- "region_id": null,
- "region": { },
- "profile_id": null,
- "profile": null,
- "provider_id": null,
- "provider": null,
- "price_type": null,
- "amount": null,
- "is_return": null,
- "admin_only": null,
- "requirements": [ ],
- "data": { },
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "product_count": 10,
- "product_type_count": 2,
- "shipping_option_count": 1,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Removes a Tax Rate from a list of Product Types
| id required | string ID of the tax rate. |
| fields | Array of strings Which fields should be included in the result. |
| expand | Array of strings Which fields should be expanded and retrieved in the result. |
| product_types required | Array of strings The IDs of the types of products to remove association with this tax rate |
required | object (Tax Rate) A Tax Rate can be used to associate a certain rate to charge on products within a given Region |
{- "product_types": [
- "string"
]
}{- "tax_rate": {
- "id": "txr_01G8XDBAWKBHHJRKH0AV02KXBR",
- "rate": 10,
- "code": "tax01",
- "name": "Tax Example",
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": { },
- "products": [
- {
- "id": null,
- "title": null,
- "subtitle": null,
- "description": null,
- "handle": null,
- "is_giftcard": null,
- "status": null,
- "images": [ ],
- "thumbnail": null,
- "options": [ ],
- "variants": [ ],
- "categories": [ ],
- "profile_id": null,
- "profile": null,
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": null,
- "collection": null,
- "type_id": null,
- "type": null,
- "tags": [ ],
- "discountable": null,
- "external_id": null,
- "sales_channels": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "product_types": [
- {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_options": [
- {
- "id": null,
- "name": null,
- "region_id": null,
- "region": { },
- "profile_id": null,
- "profile": null,
- "provider_id": null,
- "provider": null,
- "price_type": null,
- "amount": null,
- "is_return": null,
- "admin_only": null,
- "requirements": [ ],
- "data": { },
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "product_count": 10,
- "product_type_count": 2,
- "shipping_option_count": 1,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Associates a Tax Rate with a list of Products
| id required | string ID of the tax rate. |
| fields | Array of strings Which fields should be included in the result. |
| expand | Array of strings Which fields should be expanded and retrieved in the result. |
| products required | Array of strings The IDs of the products to associate with this tax rate |
required | object (Tax Rate) A Tax Rate can be used to associate a certain rate to charge on products within a given Region |
{- "products": [
- "string"
]
}{- "tax_rate": {
- "id": "txr_01G8XDBAWKBHHJRKH0AV02KXBR",
- "rate": 10,
- "code": "tax01",
- "name": "Tax Example",
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": { },
- "products": [
- {
- "id": null,
- "title": null,
- "subtitle": null,
- "description": null,
- "handle": null,
- "is_giftcard": null,
- "status": null,
- "images": [ ],
- "thumbnail": null,
- "options": [ ],
- "variants": [ ],
- "categories": [ ],
- "profile_id": null,
- "profile": null,
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": null,
- "collection": null,
- "type_id": null,
- "type": null,
- "tags": [ ],
- "discountable": null,
- "external_id": null,
- "sales_channels": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "product_types": [
- {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_options": [
- {
- "id": null,
- "name": null,
- "region_id": null,
- "region": { },
- "profile_id": null,
- "profile": null,
- "provider_id": null,
- "provider": null,
- "price_type": null,
- "amount": null,
- "is_return": null,
- "admin_only": null,
- "requirements": [ ],
- "data": { },
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "product_count": 10,
- "product_type_count": 2,
- "shipping_option_count": 1,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Removes a Tax Rate from a list of Products
| id required | string ID of the tax rate. |
| fields | Array of strings Which fields should be included in the result. |
| expand | Array of strings Which fields should be expanded and retrieved in the result. |
| products required | Array of strings The IDs of the products to remove association with this tax rate |
required | object (Tax Rate) A Tax Rate can be used to associate a certain rate to charge on products within a given Region |
{- "products": [
- "string"
]
}{- "tax_rate": {
- "id": "txr_01G8XDBAWKBHHJRKH0AV02KXBR",
- "rate": 10,
- "code": "tax01",
- "name": "Tax Example",
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": { },
- "products": [
- {
- "id": null,
- "title": null,
- "subtitle": null,
- "description": null,
- "handle": null,
- "is_giftcard": null,
- "status": null,
- "images": [ ],
- "thumbnail": null,
- "options": [ ],
- "variants": [ ],
- "categories": [ ],
- "profile_id": null,
- "profile": null,
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": null,
- "collection": null,
- "type_id": null,
- "type": null,
- "tags": [ ],
- "discountable": null,
- "external_id": null,
- "sales_channels": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "product_types": [
- {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_options": [
- {
- "id": null,
- "name": null,
- "region_id": null,
- "region": { },
- "profile_id": null,
- "profile": null,
- "provider_id": null,
- "provider": null,
- "price_type": null,
- "amount": null,
- "is_return": null,
- "admin_only": null,
- "requirements": [ ],
- "data": { },
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "product_count": 10,
- "product_type_count": 2,
- "shipping_option_count": 1,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Associates a Tax Rate with a list of Shipping Options
| id required | string ID of the tax rate. |
| fields | Array of strings Which fields should be included in the result. |
| expand | Array of strings Which fields should be expanded and retrieved in the result. |
| shipping_options required | Array of strings The IDs of the shipping options to associate with this tax rate |
required | object (Tax Rate) A Tax Rate can be used to associate a certain rate to charge on products within a given Region |
{- "shipping_options": [
- "string"
]
}{- "tax_rate": {
- "id": "txr_01G8XDBAWKBHHJRKH0AV02KXBR",
- "rate": 10,
- "code": "tax01",
- "name": "Tax Example",
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": { },
- "products": [
- {
- "id": null,
- "title": null,
- "subtitle": null,
- "description": null,
- "handle": null,
- "is_giftcard": null,
- "status": null,
- "images": [ ],
- "thumbnail": null,
- "options": [ ],
- "variants": [ ],
- "categories": [ ],
- "profile_id": null,
- "profile": null,
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": null,
- "collection": null,
- "type_id": null,
- "type": null,
- "tags": [ ],
- "discountable": null,
- "external_id": null,
- "sales_channels": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "product_types": [
- {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_options": [
- {
- "id": null,
- "name": null,
- "region_id": null,
- "region": { },
- "profile_id": null,
- "profile": null,
- "provider_id": null,
- "provider": null,
- "price_type": null,
- "amount": null,
- "is_return": null,
- "admin_only": null,
- "requirements": [ ],
- "data": { },
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "product_count": 10,
- "product_type_count": 2,
- "shipping_option_count": 1,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Removes a Tax Rate from a list of Shipping Options
| id required | string ID of the tax rate. |
| fields | Array of strings Which fields should be included in the result. |
| expand | Array of strings Which fields should be expanded and retrieved in the result. |
| shipping_options required | Array of strings The IDs of the shipping options to remove association with this tax rate |
required | object (Tax Rate) A Tax Rate can be used to associate a certain rate to charge on products within a given Region |
{- "shipping_options": [
- "string"
]
}{- "tax_rate": {
- "id": "txr_01G8XDBAWKBHHJRKH0AV02KXBR",
- "rate": 10,
- "code": "tax01",
- "name": "Tax Example",
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": { },
- "products": [
- {
- "id": null,
- "title": null,
- "subtitle": null,
- "description": null,
- "handle": null,
- "is_giftcard": null,
- "status": null,
- "images": [ ],
- "thumbnail": null,
- "options": [ ],
- "variants": [ ],
- "categories": [ ],
- "profile_id": null,
- "profile": null,
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": null,
- "collection": null,
- "type_id": null,
- "type": null,
- "tags": [ ],
- "discountable": null,
- "external_id": null,
- "sales_channels": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "product_types": [
- {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_options": [
- {
- "id": null,
- "name": null,
- "region_id": null,
- "region": { },
- "profile_id": null,
- "profile": null,
- "provider_id": null,
- "provider": null,
- "price_type": null,
- "amount": null,
- "is_return": null,
- "admin_only": null,
- "requirements": [ ],
- "data": { },
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "product_count": 10,
- "product_type_count": 2,
- "shipping_option_count": 1,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Uploads at least one file to the specific fileservice that is installed in Medusa.
| files | string <binary> |
required | Array of objects |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.uploads.create(file) .then(({ uploads }) => { console.log(uploads.length); });
{
}Removes an uploaded file using the installed fileservice
| file_key required | string key of the file to delete |
| id required | string The file key of the upload deleted |
| object required | string Default: "file" The type of the object that was deleted. |
| deleted required | boolean Default: true Whether or not the items were deleted. |
{- "file_key": "string"
}{- "id": "string",
- "object": "file",
- "deleted": true
}Creates a presigned download url for a file
| file_key required | string key of the file to obtain the download link for |
| download_url required | string The Download URL of the file |
{- "file_key": "string"
}{- "download_url": "string"
}Uploads at least one file with ACL or a non-public bucket to the specific fileservice that is installed in Medusa.
| files | string <binary> |
required | Array of objects |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.uploads.createProtected(file) .then(({ uploads }) => { console.log(uploads.length); });
{
}Retrieves all users.
required | Array of objects (User) |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.users.list() .then(({ users }) => { console.log(users.length); });
{- "users": [
- {
- "id": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "role": "admin",
- "email": "user@example.com",
- "first_name": "Levi",
- "last_name": "Bogan",
- "api_token": null,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
]
}Creates a User
| email required | string <email> The Users email. |
| password required | string <password> The Users password. |
| first_name | string The name of the User. |
| last_name | string The name of the User. |
| role | string Enum: "admin" "member" "developer" Userrole assigned to the user. |
required | object (User) Represents a User who can manage store settings. |
{- "email": "user@example.com",
- "first_name": "string",
- "last_name": "string",
- "role": "admin",
- "password": "pa$$word"
}{- "user": {
- "id": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "role": "admin",
- "email": "user@example.com",
- "first_name": "Levi",
- "last_name": "Bogan",
- "api_token": null,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Generates a password token for a User with a given email.
| email required | string <email> The Users email. |
{- "email": "user@example.com"
}{- "message": "Discount must be set to dynamic",
- "type": "not_allowed"
}Sets the password for a User given the correct token.
| token required | string The token generated from the 'password-token' endpoint. |
| password required | string <password> The Users new password. |
string <email> The Users email. |
required | object (User) Represents a User who can manage store settings. |
{- "email": "user@example.com",
- "token": "string",
- "password": "pa$$word"
}{- "user": {
- "id": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "role": "admin",
- "email": "user@example.com",
- "first_name": "Levi",
- "last_name": "Bogan",
- "api_token": null,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Retrieves a User.
| id required | string The ID of the User. |
required | object (User) Represents a User who can manage store settings. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.users.retrieve(user_id) .then(({ user }) => { console.log(user.id); });
{- "user": {
- "id": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "role": "admin",
- "email": "user@example.com",
- "first_name": "Levi",
- "last_name": "Bogan",
- "api_token": null,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Updates a User
| id required | string The ID of the User. |
| first_name | string The name of the User. |
| last_name | string The name of the User. |
| role | string Enum: "admin" "member" "developer" Userrole assigned to the user. |
| api_token | string The api token of the User. |
| metadata | object An optional set of key-value pairs with additional information. |
required | object (User) Represents a User who can manage store settings. |
{- "first_name": "string",
- "last_name": "string",
- "role": "admin",
- "api_token": "string",
- "metadata": { }
}{- "user": {
- "id": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "role": "admin",
- "email": "user@example.com",
- "first_name": "Levi",
- "last_name": "Bogan",
- "api_token": null,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}Deletes a User
| id required | string The ID of the User. |
| id required | string The ID of the deleted user. |
| object required | string Default: "user" The type of the object that was deleted. |
| deleted required | boolean Default: true Whether or not the items were deleted. |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.users.delete(user_id) .then(({ id, object, deleted }) => { console.log(id); });
{- "id": "string",
- "object": "user",
- "deleted": true
}Retrieves a list of Product Variants
| id | string A Product Variant id to filter by. |
| ids | string A comma separated list of Product Variant ids to filter by. |
| expand | string A comma separated list of Product Variant relations to load. |
| fields | string A comma separated list of Product Variant fields to include. |
| offset | number Default: "0" How many product variants to skip in the result. |
| limit | number Default: "100" Maximum number of Product Variants to return. |
| cart_id | string The id of the cart to use for price selection. |
| region_id | string The id of the region to use for price selection. |
| currency_code | string The currency code to use for price selection. |
| customer_id | string The id of the customer to use for price selection. |
string or Array of strings product variant title to search for. | |
number or object Filter by available inventory quantity |
required | Array of objects (Priced Product Variant) |
| count required | integer The total number of items available |
| offset required | integer The number of items skipped before these items |
| limit required | integer The number of items per page |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.variants.list() .then(({ variants, limit, offset, count }) => { console.log(variants.length); });
{- "variants": [
- {
- "id": "variant_01G1G5V2MRX2V3PVSR2WXYPFB6",
- "title": "Small",
- "product_id": "prod_01G1G5V2MBA328390B5AXJ610F",
- "product": { },
- "prices": [
- null
], - "sku": "shirt-123",
- "barcode": null,
- "ean": null,
- "upc": null,
- "variant_rank": 0,
- "inventory_quantity": 100,
- "allow_backorder": false,
- "manage_inventory": true,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "options": [
- null
], - "inventory_items": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}, - "purchasable": true,
- "original_price": 0,
- "calculated_price": 0,
- "original_price_incl_tax": 0,
- "calculated_price_incl_tax": 0,
- "original_tax": 0,
- "calculated_tax": 0,
- "tax_rates": [
- { }
]
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}Returns the available inventory of a Variant.
| id required | string The Product Variant id to get inventory for. |
object (AdminGetVariantsVariantInventoryRes) |
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.variants.list() .then(({ variants, limit, offset, count }) => { console.log(variants.length) })
{- "variant": {
- "variant": {
- "id": "string",
- "inventory": {
- "sku": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "title": null,
- "description": null,
- "thumbnail": null,
- "material": null,
- "weight": null,
- "height": null,
- "width": null,
- "length": null,
- "requires_shipping": null,
- "metadata": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "available_quantity": null
}, - "sales_channel_availability": {
- "channel_name": null,
- "channel_id": null,
- "available_quantity": null
}
}
}
}